//菜单
$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;
}
}
}