當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Controller::behaviors方法代碼示例

本文整理匯總了PHP中yii\web\Controller::behaviors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Controller::behaviors方法的具體用法?PHP Controller::behaviors怎麽用?PHP Controller::behaviors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\web\Controller的用法示例。


在下文中一共展示了Controller::behaviors方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['accessControl'] = $this->accessControlBehavior();
     $behaviors['accessControl']['rules'] = array_merge([['allow' => true, 'actions' => ['grid-view-settings', 'route-to-url'], 'roles' => ['@']]], $behaviors['accessControl']['rules']);
     return $behaviors;
 }
開發者ID:omnilight,項目名稱:yz2-admin,代碼行數:7,代碼來源:GeneralController.php

示例2: behaviors

 /**
  * {@inheritDoc}
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['*' => ['GET', 'AJAX'], 'file-upload' => ['POST', 'AJAX']]];
     return $behaviors;
 }
開發者ID:navatech,項目名稱:yii2-roxymce,代碼行數:10,代碼來源:ManagementController.php

示例3: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_HTML;
     //        $behaviors['contentNegotiator']['languages'] = [ 'en', 'zh-CN',];
     return $behaviors;
 }
開發者ID:bennybi,項目名稱:yii2-cza-base,代碼行數:7,代碼來源:Controller.php

示例4: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     // TODO: Change the autogenerated stub
     $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'passkey'];
     return $behaviors;
 }
開發者ID:KKRainbow,項目名稱:ngpt_seed,代碼行數:7,代碼來源:TrackerController.php

示例5: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     return $behaviors;
 }
開發者ID:AndriyK,項目名稱:team,代碼行數:7,代碼來源:DashboardController.php

示例6: behaviors

 public function behaviors()
 {
     $behaviors = parent::behaviors();
     // TODO: Change the autogenerated stub
     $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'passkey'];
     $behaviors[] = ['class' => 'yii\\filters\\ContentNegotiator', 'formats' => ['application/json' => Response::FORMAT_JSON, 'text/html' => Response::FORMAT_HTML]];
     return $behaviors;
 }
開發者ID:KKRainbow,項目名稱:ngpt_seed,代碼行數:8,代碼來源:SeedController.php

示例7: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = [['allow' => true, 'actions' => ['index'], 'roles' => ['BViewRules']]];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['create'], 'roles' => ['BCreateRules']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['BDeleteRules']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'create' => ['get', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
開發者ID:lukianovva,項目名稱:clover,代碼行數:12,代碼來源:RulesController.php

示例8: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     if (!isset($behaviors['access']['class'])) {
         $behaviors['access']['class'] = AccessControl::className();
     }
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['index', 'view'], 'roles' => ['viewBlogs']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'view' => ['get']]];
     return $behaviors;
 }
開發者ID:cjq,項目名稱:QRCode-yii2,代碼行數:13,代碼來源:DefaultController.php

示例9: behaviors

 public function behaviors()
 {
     if (is_array($this->_behaviorsData)) {
         return $this->_behaviorsData;
     }
     if (is_callable($this->_behaviorsData)) {
         return call_user_func($this->_behaviorsData, $this);
     }
     return parent::behaviors();
 }
開發者ID:mihaildev,項目名稱:yii2-flexible-controller,代碼行數:10,代碼來源:Controller.php

示例10: behaviors

 public function behaviors()
 {
     $rules = [['allow' => true, 'roles' => ['@']]];
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => $rules, 'denyCallback' => function ($rule, $action) {
         if (Yii::$app->getUser()->isGuest) {
             Yii::$app->getSession()->addFlash('warning', Yii::t('app', 'La sessione è scaduta, effettua il login'));
             Yii::$app->getUser()->loginRequired();
         }
         throw new ForbiddenHttpException(Yii::t('app', 'Non sei autorizzato a visualizzare questa pagina'));
     }], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]]);
 }
開發者ID:elitedivision,項目名稱:amos-core,代碼行數:11,代碼來源:CrudController.php

示例11: behaviors

 /**
  * Returns a list of behaviors that this component should behave as.
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $rulesIps = [];
     if (false === empty(\Yii::$app->params['secret']['allowIPs'])) {
         $rulesIps = \Yii::$app->params['secret']['allowIPs'];
     }
     $behaviors['AccessControl'] = ['class' => 'yii\\filters\\AccessControl', 'denyCallback' => function ($rule, $action) {
         throw new ForbiddenHttpException(\Yii::t('yii', 'You are not allowed to perform this action.'));
     }, 'rules' => [['allow' => true, 'ips' => $rulesIps]]];
     return $behaviors;
 }
開發者ID:phantom-d,項目名稱:yii2-file-daemon,代碼行數:15,代碼來源:StreakWebController.php

示例12: behaviors

 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['file-cache' => ['class' => HttpCache::class, 'only' => ['view', 'get'], 'lastModified' => function () {
         $id = Yii::$app->request->get('id');
         $nocache = Yii::$app->request->get('nocache', false);
         if ($nocache) {
             return time();
         }
         $filename = Yii::$app->fileStorage->get($id);
         return filemtime($filename);
     }]]);
 }
開發者ID:hiqdev,項目名稱:hipanel-core,代碼行數:12,代碼來源:FileController.php

示例13: behaviors

 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['login', 'error'], 'allow' => true], ['actions' => ['logout', 'index'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'bootstrap' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON, 'charset' => 'UTF-8'], 'languages' => ['en', 'de']]]);
     /*
     return [
                 'verbs' => [
                     'class' => VerbFilter::className(),
                     'actions' => [
                         'delete' => ['post'],
                     ],
                 ],
             ];
     */
 }
開發者ID:adem-team,項目名稱:advanced,代碼行數:14,代碼來源:RptEsmController.php

示例14: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['create' => ['post'], 'update' => ['put', 'post'], 'delete' => ['post', 'delete']]];
     return $behaviors;
 }
開發者ID:lulliz,項目名稱:qast,代碼行數:9,代碼來源:DefaultController.php

示例15: behaviors

 /**
  * {@inheritdoc}
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'only' => ['resource'], 'formats' => ['application/json' => Response::FORMAT_JSON]]]);
 }
開發者ID:hiqdev,項目名稱:hiam-core,代碼行數:7,代碼來源:OauthController.php


注:本文中的yii\web\Controller::behaviors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。