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外都使用'],