error('您尚未登录系统',url('/index/login')); } $auth=new Auth(); $request=Request::instance(); $con=$request->controller(); $action=$request->action(); $name=$con.'/'; $notCheck=array('Admin/'); if(session('id')!=1){ if(!in_array($name,$notCheck)){ if(!$auth->check($name,session('id'))){ $this->error('没有权限'); } } } $data=Db::query("select * from sys_menu order by id "); $menu= $this->getTree($data,0); $this->assign('topmenus',$menu); } public function getTree($data,$ppd) { $html = ''; $ppid=-1; foreach($data as $k =>$v) { if($v['pid'] == $ppd) { if($v['linkurl']!=null &&$v['linkurl']!="") { $html .= "
  • ".$v['pidname'].""; } else { $html .= "
  • ".$v['pidname'].""; } $ppid=$v['ppid']; $html .= $this->getTree($data,$v['id']); $html = $html ."
  • "; } } if($ppd==0) { return $html ?'': $html; } else { return $html ?'': $html; } } } ?>