Maison > Article > développement back-end > thinkphp动态加载菜单的有关问题
thinkphp动态加载菜单的问题
//用两个集合实现父子菜单的加载<br /><br />foreach($vo as $key=>$value){<br /> $vo[$key]['id']=$value['id'];<br /> $vo[$key]['menuid']=$value['menuid'];<br /> $vo[$key]['menuname']=$value['menuname'];<br /> $vo[$key]['parentid']=$value['parentid'];<br /> $vo[$key]['childid']=$value['childid'];<br /> $vo[$key]['URL']=$value['URL'];<br /> }<br /> }<br /><br /><br />foreach($v1 as $key1=>$value1){<br /> foreach($v2 as $key=>$value2){<br /> <br /> if($key1+1>=count($vo)){<br /> echo '1';<br /> break;<br /> }<br /> if($v2[$key1+1]['parentid']==$vo[$key]['menuid']){<br /> $vo[$key1+1]['parentid']=$value2['menuid'];<br /> print_r($vo[$key+1]['parentid']);<br /> <br /> }<br /> }<br /> }<br />dump($vo)