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


PHP Controller::runAction方法代碼示例

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


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

示例1: runAction

 public function runAction($id, $params = [])
 {
     // Skip \yii\console\Controller::runAction impl.
     // Don't care about options and arguments. Just pass the call through
     // to Doctrine's ConsoleRunner and let it handle everything.
     return \yii\base\Controller::runAction($id, $params);
 }
開發者ID:iw-reload,項目名稱:iw,代碼行數:7,代碼來源:DoctrineController.php

示例2: runAction

 /**
  * Runs an action with the specified action ID and parameters.
  * If the action ID is empty, the method will use [[defaultAction]].
  * @param string $id the ID of the action to be executed.
  * @param array $params the parameters (name-value pairs) to be passed to the action.
  * @return integer the status of the action execution. 0 means normal, other values mean abnormal.
  * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully.
  * @see createAction
  */
 public function runAction($id, $params = [])
 {
     if (!empty($params)) {
         $options = $this->globalOptions();
         foreach ($params as $name => $value) {
             if (in_array($name, $options, true)) {
                 $this->{$name} = $value;
                 unset($params[$name]);
             }
         }
     }
     return parent::runAction($id, $params);
 }
開發者ID:davidpersson,項目名稱:FrameworkBenchmarks,代碼行數:22,代碼來源:Controller.php

示例3: runAction

 /** @inheritdoc */
 public function runAction($id, $consoleParams = [], $params = [])
 {
     if (!empty($consoleParams)) {
         $options = $this->options($id);
         foreach ($consoleParams as $name => $value) {
             if (in_array($name, $options, true)) {
                 $default = $this->{$name};
                 $this->{$name} = is_array($default) ? preg_split('/\\s*,\\s*/', $value) : $value;
                 unset($consoleParams[$name]);
             } elseif (!is_int($name)) {
                 throw new Exception(Yii::t('yii', 'Unknown option: --{name}', ['name' => $name]));
             }
         }
     }
     return BaseController::runAction($id, $params);
 }
開發者ID:barney-k,項目名稱:yii2-migration-module,代碼行數:17,代碼來源:MigrateController.php

示例4: runAction

 /**
  * Runs an action with the specified action ID and parameters.
  * If the action ID is empty, the method will use [[defaultAction]].
  * @param string $id the ID of the action to be executed.
  * @param array $params the parameters (name-value pairs) to be passed to the action.
  * @return integer the status of the action execution. 0 means normal, other values mean abnormal.
  * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully.
  * @throws Exception if there are unknown options or missing arguments
  * @see createAction
  */
 public function runAction($id, $params = [])
 {
     if (!empty($params)) {
         // populate options here so that they are available in beforeAction().
         $options = $this->options($id);
         foreach ($params as $name => $value) {
             if (in_array($name, $options, true)) {
                 $default = $this->{$name};
                 $this->{$name} = is_array($default) ? preg_split('/\\s*,\\s*/', $value) : $value;
                 unset($params[$name]);
             } elseif (!is_int($name)) {
                 throw new Exception(Yii::t('yii', 'Unknown option: --{name}', ['name' => $name]));
             }
         }
     }
     return parent::runAction($id, $params);
 }
開發者ID:avron99,項目名稱:delayed-orders,代碼行數:27,代碼來源:Controller.php

示例5: runAction

 /**
  * Runs an action with the specified action ID and parameters.
  * If the action ID is empty, the method will use [[defaultAction]].
  * @param string $id the ID of the action to be executed.
  * @param array $params the parameters (name-value pairs) to be passed to the action.
  * @return integer the status of the action execution. 0 means normal, other values mean abnormal.
  * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully.
  * @throws Exception if there are unknown options or missing arguments
  * @see createAction
  */
 public function runAction($id, $params = [])
 {
     if (!empty($params)) {
         // populate options here so that they are available in beforeAction().
         $options = $this->options($id === '' ? $this->defaultAction : $id);
         if (isset($params['_aliases'])) {
             $optionAliases = $this->optionAliases();
             foreach ($params['_aliases'] as $name => $value) {
                 if (array_key_exists($name, $optionAliases)) {
                     $params[$optionAliases[$name]] = $value;
                 } else {
                     throw new Exception(Yii::t('yii', 'Unknown alias: -{name}', ['name' => $name]));
                 }
             }
             unset($params['_aliases']);
         }
         foreach ($params as $name => $value) {
             if (in_array($name, $options, true)) {
                 $default = $this->{$name};
                 if (is_array($default)) {
                     $this->{$name} = preg_split('/(?!\\(\\d+)\\s*,\\s*(?!\\d+\\))/', $value);
                 } elseif ($default !== null) {
                     settype($value, gettype($default));
                     $this->{$name} = $value;
                 } else {
                     $this->{$name} = $value;
                 }
                 $this->_passedOptions[] = $name;
                 unset($params[$name]);
             } elseif (!is_int($name)) {
                 throw new Exception(Yii::t('yii', 'Unknown option: --{name}', ['name' => $name]));
             }
         }
     }
     return parent::runAction($id, $params);
 }
開發者ID:sadiqhirani,項目名稱:yii2,代碼行數:46,代碼來源:Controller.php

示例6: runAction

 public function runAction($id, $params = array())
 {
     $params = array_merge($_POST, $params);
     return parent::runAction($id, $params);
 }
開發者ID:janwillemm,項目名稱:sa-matcher,代碼行數:5,代碼來源:BaseController.php


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