Yii2 需要所有控制器和操作才能登录
在我的网站控制器中,我这样写
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['logout', 'index' ,'call-back'], // add all actions to take guest to login page
'allow' => true,
'roles' => ['@'],
],
],
],
所以如果我去索引或回调操作,我会重定向到登录页面。但是我必须为每个控制器的所有操作执行此操作。你能告诉我最好的方法吗?