五表聯查、一級、二級菜單的顯示
阿新 • • 發佈:2018-08-09
nbsp div name and 顯示 one () res aid
//五表聯查
$b=Db::table(‘user‘)
->join(‘userrole‘,‘user.uid =userrole.u_id‘)
->join(‘role‘,‘userrole.r_id = role.rid‘)
->join(‘roleaccese‘,‘role.rid =roleaccese.role_id‘)
->join(‘accese‘,‘roleaccese.accese_id =accese.aid‘)
->where("uname=‘$uname‘ and upass=‘$upass‘")
->select();
//一級菜單
$arr=[];
foreach ($b as $key => $v){
$arr[‘uname‘]=$v[‘uname‘];
$arr[‘upass‘]=$v[‘upass‘];
$arr["rname"]=$v[‘rname‘];
$arr[‘one_menu‘][]=[‘aname‘=>$v[‘aname‘],‘aurl‘=>$v[‘aurl‘],‘pid‘=>$v[‘pid‘],‘aid‘=>$v[‘aid‘]];
}
//二級菜單
foreach($arr[‘one_menu‘] as $k =>$vv){
$res=Db::table("accese")->where("pid=".$vv[‘aid‘])->select();
$arr[‘one_menu‘][$k][‘two_menu‘]=$res;
}
//表單展示
<div>
<ul>
{volist name="list.one_menu" id="v"}
<li><a href="{$v.aurl}">{$v.aname}</a></li>
<div>
<ul>
{volist name="v.two_menu" id="vo"}
<li><a href="{$vo.aurl}">{$vo.aname}</a></li>
{/volist}
</ul>
</div>
{/volist}
</ul>
</div>
五表聯查、一級、二級菜單的顯示