登录权限

public function _initialize()
{
if (!Session::has('user', 'think')) {
$this->error('非法登录', 'Login/index');
}
$this->get_date();
}

public function get_date(){
$controller = Request::instance()->controller();
$action = Request::instance()->action();
$node = Session::get("access","think");
$flag = false;
foreach($node as $key=>$value){
if($value['controller_name'] == $controller && $value['action_name'] == $action){$flag = true;}if($action=="page"){$flag=true;//如果该用户中有权限则为true}}if($flag == false){$this->error("您没有权限");

if(data.msg){alert('您没有权限');return false;}

posted @ 2019-01-05 11:02  垖垏尐  阅读(156)  评论(0编辑  收藏  举报