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


PHP Action::__construct方法代码示例

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


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

示例1: __construct

 public function __construct($id, $controller, $config = [])
 {
     parent::__construct($id, $controller, $config);
     if (is_array($this->sort) && !isset($this->sort["class"])) {
         $this->sort["class"] = Sort::className();
         $this->sort = \Yii::createObject($this->sort);
     }
     if ($this->sort == null) {
         $this->sort = \Yii::createObject(Sort::className());
     }
     if ($this->searchModelClass == null && class_exists($this->modelClass . "Search")) {
         $this->searchModelClass = $this->modelClass . "Search";
     }
 }
开发者ID:rocketyang,项目名称:hasscms-app,代码行数:14,代码来源:IndexAction.php

示例2: __construct

 public function __construct($id, $controller, $config = [])
 {
     $controller->enableCsrfValidation = false;
     parent::__construct($id, $controller, $config);
 }
开发者ID:postor,项目名称:yii2-wechat,代码行数:5,代码来源:WeChatAction.php

示例3: __construct

 /**
  * @param string $id the ID of this action
  * @param Controller $controller the controller that owns this action
  * @param string $actionMethod the controller method that this inline action is associated with
  * @param array $config name-value pairs that will be used to initialize the object properties
  */
 public function __construct($id, $controller, $actionMethod, $config = [])
 {
     $this->actionMethod = $actionMethod;
     parent::__construct($id, $controller, $config);
 }
开发者ID:yiisoft,项目名称:yii2,代码行数:11,代码来源:InlineAction.php

示例4: __construct

 /**
  * 重写Constructor,增加参数的初始化处理
  *
  * @param string $id
  *            the ID of this action
  * @param Controller $controller
  *            the controller that owns this action
  * @param array $config
  *            name-value pairs that will be used to initialize the object properties
  */
 public function __construct($id, $controller, $config = [])
 {
     //初始化modelClass
     if (empty($this->modelClass)) {
         if (isset($controller->modelClass) && !empty($controller->modelClass)) {
             $this->modelClass = $controller->modelClass;
         } else {
             throw new InvalidConfigException("modelClass of action {$id} can not be empty!");
         }
     }
     if (!class_exists($this->modelClass)) {
         throw new InvalidConfigException("modelClass {$this->modelClass} dosen't exist!");
     }
     //初始化跳转地址
     if (empty($this->redirectRoute)) {
         if (isset($controller->redirectRoute) && !empty($controller->redirectRoute)) {
             $this->redirectRoute = $controller->redirectRoute;
         } else {
             $this->redirectRoute = '/' . $controller->module->id . '/' . $controller->id . '/index';
         }
     }
     parent::__construct($id, $controller, $config);
 }
开发者ID:tksoftcn,项目名称:yii2-enhance,代码行数:33,代码来源:BaseAction.php

示例5: __construct

 /**
  * @param string $id
  * @param Controller $controller
  * @param ConfigInterface $flowConfig
  * @param array $config
  */
 public function __construct($id, $controller, ConfigInterface $flowConfig, $config = [])
 {
     $this->flowConfig = $flowConfig;
     parent::__construct($id, $controller, $config);
 }
开发者ID:cyhalothrin,项目名称:yiiflow,代码行数:11,代码来源:Action.php


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