php左侧二级折叠菜单用循环输出?while或者foreach都行,大类和小类分别储存在2个表,求代码。
1个回答
展开全部
$sql_a="select * from `ecs_nav` where `type`='middle' order by `id`";
$res_a=$db->getAll($sql_a);
foreach($res_a as $key=> $value){
$sql_b="select * from `ecs_nav` where `type`='".$value['id']."' order by `id`";
$res_b=$db->getAll($sql_b);
$res_a [$key] [0] = $res_b;
}
$res_a=$db->getAll($sql_a);
foreach($res_a as $key=> $value){
$sql_b="select * from `ecs_nav` where `type`='".$value['id']."' order by `id`";
$res_b=$db->getAll($sql_b);
$res_a [$key] [0] = $res_b;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询