當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。