Blogger Information
Blog 1
fans 0
comment 0
visits 904
Related recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
把子集数组放到父级数组
张忠冉的博客
Original
906 people have browsed it

//菜单
$menu = M('menu');
//父级
$pids = $menu->where("pid = 0")->select();
//子集
$cids = $menu->where("pid != 0")->select();
foreach($pids as $k=>$v){
   foreach($cids as $kk=>$vv){
       if($v['cid'] == $vv['pid']){
           $pids[$k]['zj'][] = $vv;
       }
   }
}

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!