-1
我有一个这样的数组:PHP指数数组关联第一元素等于第二等
$actions = array(
"controller",
"index",
"method",
"default",
);
我想要得到的第一个关键等于第二键等等这样
$actions = array(
"controller" => "index",
"method" => "default"
);
我该如何做到这一点,谢谢!
在[所以]你应该尝试**自己写代码**。后** [做更多的研究](//meta.stackoverflow.com/questions/261592)**如果你有问题,你可以**发布你已经尝试**与清楚的解释是什么是'工作**并提供[** Minimal,Complete和Verifiable示例**](// stackoverflow.com/help/mcve)。我建议阅读[问]一个好问题和[完美问题](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)。另外,一定要参加[游览]并阅读[this](// meta.stackoverflow.com/questions/347937/)**。 –
循环遍历你的数组使用for循环在这里检查循环http://php.net/manual/en/control-structures.for.php –