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