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


PHP Controller::init方法代碼示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     $this->token = (require __DIR__ . '/token.php');
     $this->datePath = __DIR__ . "/dateLastQuery.txt";
     $this->dateLastQuery = $this->getDateLastQuery();
 }
開發者ID:Olwn,項目名稱:pm25,代碼行數:7,代碼來源:AirQualityController.php

示例2: init

 public function init()
 {
     if (strncmp($this->filename, './', 2) == 0) {
         $this->filename = Yii::$app->getBasePath() . substr($this->filename, 1);
     }
     parent::init();
 }
開發者ID:ivan-chkv,項目名稱:yii2-kladovka,代碼行數:7,代碼來源:GenerateController.php

示例3: init

 public function init()
 {
     parent::init();
     if (empty(Yii::$app->params['hook_secret'])) {
         throw new Exception('Config param "hook_secret" is not configured!');
     }
 }
開發者ID:yiisoft-contrib,項目名稱:github-bot,代碼行數:7,代碼來源:GithubController.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     foreach ($this->generators as $id => $config) {
         $this->generators[$id] = Yii::createObject($config);
     }
 }
開發者ID:yangguanghui,項目名稱:yii2-extension-final,代碼行數:10,代碼來源:GenerateController.php

示例5: init

 public function init()
 {
     parent::init();
     $this->gman_worker = new \GearmanWorker();
     $this->gman_worker->addServers($this->module->gman_server);
     $this->gman_client = new \GearmanClient();
     $this->gman_client->addServers($this->module->gman_server);
 }
開發者ID:didwjdgks,項目名稱:yii2-ebid-ex,代碼行數:8,代碼來源:Controller.php

示例6: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     // allow console requests only
     if (!Yii::$app->request->isConsoleRequest) {
         throw new HttpException(404, 'The requested page does not exist.');
     }
     parent::init();
 }
開發者ID:anawatom,項目名稱:second,代碼行數:11,代碼來源:CopyController.php

示例7: init

 public function init()
 {
     parent::init();
     $this->api = Module::getInstance()->api;
     foreach ($this->allowedApiOptions as $option) {
         $this->{$option} = null;
     }
 }
開發者ID:gogl92,項目名稱:yii2-teleduino,代碼行數:8,代碼來源:ApiController.php

示例8: init

 public function init()
 {
     if (!\Yii::$app instanceof ConsoleApplication) {
         throw new Exception('Yii::$app is not an instance of ConsoleApplication.');
         return Controller::EXIT_CODE_ERROR;
     }
     parent::init();
 }
開發者ID:jeremyltn,項目名稱:yii2-scheduler,代碼行數:8,代碼來源:ScheduleController.php

示例9: init

 /**
  * Init
  */
 public function init()
 {
     parent::init();
     // Support cyrillic on windows
     if ($this->isWindows()) {
         system("chcp 65001");
     }
 }
開發者ID:uaoleg,項目名稱:vvkp.in.ua,代碼行數:11,代碼來源:BaseController.php

示例10: init

 public function init()
 {
     pcntl_signal(SIGTERM, [$this, 'signalHandler']);
     pcntl_signal_dispatch();
     parent::init();
     if (self::$queue === null) {
         self::$queue = Yii::$app->{$this->queueObjectName};
     }
 }
開發者ID:AtlasGit,項目名稱:yii2-queue,代碼行數:9,代碼來源:QueueController.php

示例11: init

 public function init()
 {
     if (\Yii::$app->has($this->schedule)) {
         $this->schedule = Instance::ensure($this->schedule, Schedule::className());
     } else {
         $this->schedule = \Yii::createObject(Schedule::className());
     }
     parent::init();
 }
開發者ID:gietos,項目名稱:yii2-scheduling,代碼行數:9,代碼來源:ScheduleController.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->db = Instance::ensure($this->db, Connection::class);
     if (empty($this->db_driver)) {
         $this->db_driver = $this->db->driverName;
     }
     $this->prepareCredentials();
 }
開發者ID:cookyii,項目名稱:base,代碼行數:12,代碼來源:Controller.php

示例13: init

 public function init()
 {
     parent::init();
     $this->token = (require __DIR__ . '/token.php');
     $this->datePath = __DIR__ . "/dateLastQuery.txt";
     $this->dateLastQuery = $this->getDateLastQuery();
     set_time_limit(0);
     //0表示沒有限製
     ini_set('memory_limit', '500M');
 }
開發者ID:Olwn,項目名稱:pm25,代碼行數:10,代碼來源:CreateController.php

示例14: init

 /**
  * Init function
  */
 public function init()
 {
     parent::init();
     //set PCNTL signal handlers
     pcntl_signal(SIGTERM, ['vyants\\daemon\\DaemonController', 'signalHandler']);
     pcntl_signal(SIGHUP, ['vyants\\daemon\\DaemonController', 'signalHandler']);
     pcntl_signal(SIGUSR1, ['vyants\\daemon\\DaemonController', 'signalHandler']);
     pcntl_signal(SIGCHLD, ['vyants\\daemon\\DaemonController', 'signalHandler']);
     $this->shortName = $this->shortClassName();
 }
開發者ID:aoyel,項目名稱:yii2-daemon,代碼行數:13,代碼來源:DaemonController.php

示例15: init

 /**
  * {@inheritDoc}
  */
 public function init()
 {
     try {
         if (!isset(Yii::$app->getI18n()->translations['udokmeci.beanstalkd'])) {
             Yii::$app->getI18n()->translations['udokmeci.beanstalkd'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@app/messages', 'sourceLanguage' => 'en', 'fileMap' => []];
         }
     } catch (\Pheanstalk\Exception\ConnectionException $e) {
         Yii::error($e);
     }
     return parent::init();
 }
開發者ID:G1K,項目名稱:yii2-beanstalk,代碼行數:14,代碼來源:BeanstalkController.php


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