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