授权访问 AccessControl 不起作用 [ 2.0 版本 ]
想做一个 AccessController 授权访问,在控制器中的方法中这么写:
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['create', 'update', 'index', 'resetpwd', 'view'],
'allow' => true,
'roles' => ['@'],
],
],
],
];
}
本意是只有登录用户才能访问这些页面,但是现在游客也可以访问,不起作用,我哪里写错了吗?
Sanlence 补充于 2019-05-08 15:37
写错了Controller了
共 1 个回答
Sanlence
注册时间:2017-04-10
最后登录:2021-07-24
在线时长:5小时48分
最后登录:2021-07-24
在线时长:5小时48分
- 粉丝0
- 金钱115
- 威望0
- 积分165