登录权限

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;}

原文地址:https://www.cnblogs.com/gwhm/p/10223670.html