本文整理汇总了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]]]]);
}