Home > php教程 > php手册 > RBAC中的saveAccessList dump($_SESSION)为空,请指点

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

WBOY
Release: 2016-06-07 11:41:20
Original
1003 people have browsed it

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', //节点表名称

附件 QQ图片20140801150450.jpg ( 83.94 KB 下载:13 次 )

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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template