Yii2自带的权限控制默认只支持两个角色:
guest(游客,没有登录的,用?表示)
authenticated (登录了的,用@表示)
'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => [], 'allow' => true, ], [ 'actions' => ['index', 'add'], 'allow' => true, 'roles' => ['@'], ], ], ],
关键字词: