标签:table bsp uname url OLE tab href select HERE
//五表联查
$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>
标签:table bsp uname url OLE tab href select HERE
原文地址:https://www.cnblogs.com/chaihtml/p/9445843.html