他是继承 `
yii\rest\Controller;
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => CompositeAuth::className(),
'authMethods' => [
HttpBasicAuth::className(),
HttpBearerAuth::className(),
QueryParamAuth::className(),
],
];
$behaviors['access'] = [
'class' => \yii\filters\AccessControl::className(),
'only' => $this->actions,
'except' => $this->except,
'rules' => [
[
'allow' => false,
'actions' => empty($this->mustlogin) ? [] : $this->mustlogin,
'roles' => ['?'], // guest
],
[
'allow' => true,
'actions' => empty($this->mustlogin) ? [] : $this->mustlogin,
'roles' => ['@'],
],
],
];
$behaviors['verbs']=[
'class' => \yii\filters\VerbFilter::className(),
'actions' => $this->verbs,
];
return $behaviors;
}
你想表达什么,兄弟,喝口水,慢慢说