欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

RBAC中的saveAccessList dump($_SESSION)为空,请指点

程序员文章站 2024-02-06 09:57:04
...
RBAC中的saveAccessList dump($_SESSION)为空
array (size=5)
'code' => string '75c084449d4e710f45f1bfac493aeaea' (length=32)
'username' => string 'xiao5' (length=5)
'id' => string '10' (length=2)
'authid' => string '10' (length=2)
'_ACCESS_LIST' =>
array (size=1)
'HOME' =>
array (size=2)
'RBAC' =>
array (size=2)
...
'ARTICLE' =>
array (size=1)
...


public function checkLogin() {
$username = $_POST['username'];
$password = md5($_POST['password']);
$code = $_POST['code'];
if ($_POST['code'] !== $code) {
$this -> error('验证码不正确!', U('Login/index'));
}
$user = M('User');
$where['username'] = $username;
$where['password'] = $password;
$arr = $user -> where($where) -> find();
if ($arr) {
$_SESSION['username'] = $username;
$_SESSION['id'] = $arr['id'];
$_SESSION[C('USER_AUTH_KEY')] = $arr['id'];
if ($_SESSION['username'] == C('RBAC_SUPERADMN')) {
$_SESSION[C('ADMN_AUTH_KEY')] = true;
}
import('ORG.Util.RBAC');
RBAC::saveAccessList();
//dump($_SESSION);
$this -> success('用户登录成功', U('Index/index'));
} else {
$this -> error('账号或密码错误!', U('Login/index'));
}
}



'RBAC_SUPERADMIN' => 'admin', //超级管理员名称
'ADMIN_AUTH_KEY' => 'superadmin', //超级管理员识别
'USER_AUTH_ON' => true, //是否开启验证
'USER_AUTH_TYPE' => 1, //验证类型 (1 登录验证 2 实时验证)
'USER_AUTH_KEY' => 'authid', //用户谁识别号
'NOT_AUTH_MODULE' => 'Index', //无需认证模块
//'NOT_AUTH_ACTION' => '', //无需验证的动作方法
'USER_AUTH_MODEL' =>'User',
'RBAC_ROLE_TABLE' => 'tp_role', //角色表名称
'RBAC_USER_TABLE' => 'tp_role_user', //角色和用户的中间表名称
'RBAC_ACCESS_TABLE' => 'tp_access', //权限表名称
'RBAC_NODE_TABLE' => 'tp_node', //节点表名称

RBAC中的saveAccessList dump($_SESSION)为空,请指点 QQ图片20140801150450.jpg ( 83.94 KB 下载:13 次 )

AD:真正免费,域名+虚机+企业邮箱=0元