public function getcates($arr,$fid=0)
{
static $re = array();
foreach($arr as $vo)
{
if($vo['fid']==$fid)
{
$re[] = $vo;
$this->getcates($arr,$vo['id']);
}
}
return $re;
}
public function useraction($arr,$pid=0)
{
static $re = array();
foreach($arr as $vo)
{
if($vo['pid']==$pid)
{
$re[] = $vo;
$this->useraction($arr,$vo['id']);
}
}
return $re;
}
public function menu(){
$data=array("id"=>session("id"));
$obj=D();
$where=array("adminid"=>$data['id']);
$res=$obj->table("ly_admingroup")->where($where)->find();
$where=array("group_id"=>$res['groupid']);
$res1=$obj->table("ly_groupaction")->where($where)->find();
$str=$res1["module"];
$arr=explode(",",$str);
$where=array("id"=>array("in",$arr));
$a_arr=$obj->table("ly_action")->where($where)->select();
$a_catearr=$this->useraction($a_arr);
foreach($a_catearr as $j=>$i){
foreach($a_catearr as $jk=>$iv){
if($i['id']==$iv['pid'] ){
$sodo[$i['action_name']][]=$iv;
}
}
}
$this->assign('menu_list',$sodo)->display();
}
![这里写图片描述](https://img-blog.csdn.net/20170725213004009?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXFfMzU2Njk2NTk=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)