本文整理匯總了PHP中yii\base\Module::behaviors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Module::behaviors方法的具體用法?PHP Module::behaviors怎麽用?PHP Module::behaviors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\base\Module
的用法示例。
在下文中一共展示了Module::behaviors方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: behaviors
public function behaviors()
{
//指定ip不需簽名
if (in_array(yii::$app->request->getUserIP(), yii::$app->params['WithoutVerifyIP'])) {
return parent::behaviors();
}
return ArrayHelper::merge(parent::behaviors(), ['authenticator' => ['class' => HttpBasicAuth::className(), 'auth' => 'common\\models\\User::findByPasswordResetToken', 'except' => ['api/qiniu-callback']]]);
}
示例2: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
if (!empty($this->behaviors)) {
return $this->behaviors;
} else {
return parent::behaviors();
}
}
示例3: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
if (!$this->isActionPublic()) {
$behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [['class' => QueryParamAuth::className(), 'tokenParam' => 'access_token'], ['class' => HttpBasicAuth::className(), 'auth' => [$this, 'authByPassword']]]];
}
Yii::$app->response->format = Response::FORMAT_JSON;
return $behaviors;
}
示例4: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'access_token'];
return $behaviors;
}
示例5: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [RequestHeaderAuth::className(), QueryParamAuth::className()]];
return $behaviors;
}
示例6: behaviors
public function behaviors()
{
return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => $this->roles]]]]);
}