yii2 behaviors
1、使用控制过滤器,
return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'actions' => ['index'], 'roles' => ['@'], ], [ 'allow' => true, 'actions' => ['index'], 'ips' => ['127.0.0.1'], ] ], ] ]; }
1、使用控制过滤器,
return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'actions' => ['index'], 'roles' => ['@'], ], [ 'allow' => true, 'actions' => ['index'], 'ips' => ['127.0.0.1'], ] ], ] ]; }