当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveController::init方法代码示例

本文整理汇总了PHP中yii\rest\ActiveController::init方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveController::init方法的具体用法?PHP ActiveController::init怎么用?PHP ActiveController::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\rest\ActiveController的用法示例。


在下文中一共展示了ActiveController::init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     if (!$this->modelName) {
         $this->modelName = StringHelper::basename(get_class($this), 'Controller');
     }
     if (!$this->modelClass) {
         $modelClass = 'app\\models\\' . $this->modelName;
         if (class_exists($modelClass)) {
             $this->modelClass = $modelClass;
         } else {
             $modelClass = 'app\\models\\readonly\\' . $this->modelName;
             if (class_exists($modelClass)) {
                 $this->modelClass = $modelClass;
             }
         }
     }
     if (!$this->filterModelClass) {
         $filterModelClass = 'app\\models\\search\\' . $this->modelName . 'Search';
         if (class_exists($filterModelClass)) {
             $this->filterModelClass = $filterModelClass;
         } else {
             $filterModelClass = 'app\\models\\readonly\\search\\' . $this->modelName . 'Search';
             if (class_exists($filterModelClass)) {
                 $this->filterModelClass = $filterModelClass;
             }
         }
     }
     parent::init();
 }
开发者ID:ivan-chkv,项目名称:yii2-mozayka,代码行数:29,代码来源:ActiveController.php

示例2: init

 public function init()
 {
     if (!$this->modelClass) {
         $this->modelClass = Inflector::pluralize($this->id);
     }
     \Yii::$app->request->getRawBody();
     \Yii::$app->getResponse()->getHeaders()->add('Access-Control-Allow-Origin', '*');
     parent::init();
 }
开发者ID:portalsway2,项目名称:APEDevices,代码行数:9,代码来源:Controller.php

示例3: init

 public function init()
 {
     parent::init();
     if ($this->relationAttribute === null) {
         throw new InvalidConfigException('The "relationAttribute" property must be set.');
     }
     if ($this->relations === null) {
         throw new InvalidConfigException('The "relations" property must be set.');
     }
     if ($this->searchClass === null) {
         throw new InvalidConfigException('The "searchClass" property must be set.');
     }
 }
开发者ID:shaan360,项目名称:Yii2_foundation-apps,代码行数:13,代码来源:NestedActiveController.php

示例4: init

 public function init()
 {
     parent::init();
     XiiVersion::run(self::XII_VERSION);
     if ($this->modelClass === 'XiiAcPlus') {
         XiiError::sendError(0, 'The "modelClass" property must be set.');
         Yii::$app->end();
     }
     $this->_requestCurrent = Yii::$app->request->getMethod();
     XiiError::open();
     $this->_modelClass = new $this->modelClass();
     switch ($this->_requestCurrent) {
         case 'GET':
             $this->_requestData = Yii::$app->request->get();
             $this->_requestIds = isset($this->_requestData['id']) ? $this->_requestData['id'] : '';
             break;
         case 'POST':
             $this->_requestData = Yii::$app->request->post();
             break;
         case 'PUT':
             parse_str(file_get_contents('php://input'), $put_vars);
             $this->_requestData = $put_vars;
             $this->_requestIds = Yii::$app->request->get();
             $this->_requestData = array_merge($this->_requestData, $this->_requestIds);
             break;
         case 'DELETE':
             parse_str(file_get_contents('php://input'), $put_vars);
             $this->_requestData = $put_vars;
             $this->_requestIds = Yii::$app->request->get();
             break;
         default:
             $this->_requestData = Null;
             break;
     }
     if (isset($this->_requestData[$this->_requestValidField])) {
         $this->_requestValidData[$this->_requestValidField] = $this->_requestData[$this->_requestValidField];
         unset($this->_requestData[$this->_requestValidField]);
     }
 }
开发者ID:heartshare,项目名称:Xii2,代码行数:39,代码来源:XiiAcPlus.php

示例5: init

 public function init()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     parent::init();
 }
开发者ID:veretilosergei1985,项目名称:learni,代码行数:5,代码来源:ApiController.php

示例6: init

 public function init()
 {
     parent::init();
     Yii::$app->user->enableSession = false;
     Yii::$app->response->format = 'json';
 }
开发者ID:sunil120,项目名称:yii2,代码行数:6,代码来源:ApiController.php

示例7: init

 public function init()
 {
     parent::init();
     Yii::$app->user->enableSession = false;
 }
开发者ID:GeekBand,项目名称:GeekBand-SampleProject-ServerAPI,代码行数:5,代码来源:UserController.php

示例8: init

 /**
  * Initializer of the controller
  *
  **/
 public function init()
 {
     parent::init();
 }
开发者ID:timelessmemory,项目名称:uhkklp,代码行数:8,代码来源:RestController.php

示例9: init

 public function init()
 {
     return parent::init();
     $this->checkHeader()->setSessionID();
 }
开发者ID:jiayuwinds,项目名称:xl,代码行数:5,代码来源:AppController.php

示例10: init

 public function init()
 {
     parent::init();
     \Yii::$app->user->enableSession = false;
     \Yii::$app->user->loginUrl = null;
 }
开发者ID:pham186,项目名称:yii2,代码行数:6,代码来源:ApiController.php


注:本文中的yii\rest\ActiveController::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。