当前位置: 首页>>代码示例>>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;未经允许,请勿转载。