时间:2021-07-01 10:21:17 帮助过:22人阅读
//用两个集合实现父子菜单的加载
foreach($vo as $key=>$value){
$vo[$key]['id']=$value['id'];
$vo[$key]['menuid']=$value['menuid'];
$vo[$key]['menuname']=$value['menuname'];
$vo[$key]['parentid']=$value['parentid'];
$vo[$key]['childid']=$value['childid'];
$vo[$key]['URL']=$value['URL'];
}
}
foreach($v1 as $key1=>$value1){
foreach($v2 as $key=>$value2){
if($key1+1>=count($vo)){
echo '1';
break;
}
if($v2[$key1+1]['parentid']==$vo[$key]['menuid']){
$vo[$key1+1]['parentid']=$value2['menuid'];
print_r($vo[$key+1]['parentid']);
}
}
}
dump($vo)