下面的代码,我拿到数据库中的数据$data,并转为数组,数组遍历过程中拿到['href']中的值,并json_decode一下转为数组,遍历数组格式打开出来如(2)所示。
现在我想拿$arr中的['param'],我用$arr['param']和$arr[1]都拿不到值,为什么 ?
$data=$navMenuModel->where($where)->order('list_order ASC')->select()->toArray();
foreach ($data as $vo){
$arr=json_decode($vo['href'],true);
dump($arr);
}
(1)
array(2) {
["action"] => string(17) "portal/List/index"
["param"] => array(1) {
["id"] => int(6)
}
}
(2)