YII2 自定义控制器验证 behaviors()

public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'except' => ['gamedownload', 'detail', 'gamecommentlist', 'gamecommentlist', 'ajaxcmtlist', 'gamepostslist', 'ajaxpostlist', 'ajaxcmtreply'],
'rules' => [
[
//只允许验证过的用户(登录状态的用户)访问
'allow' => true,
'roles' => ['@'],
],
],
],
];
}

 // 'only' => ['只使用的action'],
 // 'except' => ['除了这些action外都使用'],
posted @ 2018-09-05 14:00  坚持!!  阅读(1326)  评论(0编辑  收藏  举报