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


PHP Model::__construct方法代碼示例

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


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

示例1: __construct

 /**
  * 構造函數
  * @param string $name 模型名稱
  * @param string $tablePrefix 表前綴
  * @param mixed $connection 數據庫連接信息
  */
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     /* 設置默認的表前綴 */
     $this->tablePrefix = C('DB_PREFIX') . 'document_';
     /* 執行構造方法 */
     parent::__construct($name, $tablePrefix, $connection);
 }
開發者ID:FortuneZhang,項目名稱:yershop,代碼行數:13,代碼來源:BaseLogic.class.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->logerSer = D('Log', 'Service');
     $this->userSer = D('User', 'Service');
     $this->toolkitSer = D('ToolKit', 'Service');
 }
開發者ID:huzhengchuan,項目名稱:pay,代碼行數:7,代碼來源:OperLogService.class.php

示例3: __construct

 /**
  * 根據userid初始化模型實際的數據表
  */
 public function __construct($userid)
 {
     if (intval($userid) > 0) {
         $this->tableName = 'user_errquestion_' . spf_table($userid);
     }
     parent::__construct($this->tableName);
 }
開發者ID:88659108,項目名稱:tiku-system,代碼行數:10,代碼來源:UserErrQuestionModel.class.php

示例4: __construct

 /**
  * 根據userid初始化模型實際的數據表
  */
 public function __construct($qid)
 {
     if (intval($qid) > 0) {
         $this->tableName = 'user_notes_' . spf_table($qid);
     }
     parent::__construct($this->tableName);
 }
開發者ID:88659108,項目名稱:tiku-system,代碼行數:10,代碼來源:UserNotesModel.class.php

示例5: __construct

 /**
  * 架構函數
  * 取得DB類的實例對象 字段檢查
  * @access public
  * @param string $name 模型名稱
  * @param string $tablePrefix 表前綴
  * @param mixed $connection 數據庫連接信息
  */
 public function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     // 聚合模型的字段信息
     if (empty($this->fields) && !empty($this->modelList)) {
         $fields = array();
         foreach ($this->modelList as $model) {
             // 獲取模型的字段信息
             $result = $this->db->getFields(M($model)->getTableName());
             $_fields = array_keys($result);
             // $this->mapFields  =   array_intersect($fields,$_fields);
             $fields = array_merge($fields, $_fields);
         }
         $this->fields = $fields;
     }
     // 設置第一個模型為主表模型
     if (empty($this->masterModel) && !empty($this->modelList)) {
         $this->masterModel = $this->modelList[0];
     }
     // 主表的主鍵名
     $this->pk = M($this->masterModel)->getPk();
     // 設置默認外鍵名 僅支持單一外鍵
     if (empty($this->fk)) {
         $this->fk = strtolower($this->masterModel) . '_id';
     }
 }
開發者ID:Aaron-zh,項目名稱:ThinkPHPFull,代碼行數:34,代碼來源:MergeModel.class.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     $this->logerSer = D('Log', 'Service');
     $this->toolkitSer = D('ToolKit', 'Service');
     $this->redisSer = new RedisSetService();
 }
開發者ID:huzhengchuan,項目名稱:trader,代碼行數:7,代碼來源:OrderService.class.php

示例7: __construct

 public function __construct()
 {
     $this->p = (int) I('get.p');
     $this->pageSize = I("get.pagesize") !== "" ? I("get.pagesize") : (C("YUNZHI_PAGE_SIZE") ? C("YUNZHI_PAGE_SIZE") : 20);
     $this->keywords = trim(I('get.keywords'));
     $this->field = I('get.field') === "" || (int) I('get.field') ? $this->field : I('get.field');
     if (trim(I('get.filed')) !== "") {
         $filed = trim(I('get.field'));
     }
     if ($this->keywords !== "") {
         $this->maps[$this->field] = array("like", "%" . $this->keywords . "%");
     }
     if (I("get.by") !== "") {
         $by = I("get.by");
         $order = I("get.order");
         $this->setOrderBys(array($by => $order));
     } else {
         if (I("get.order") !== "") {
             $by = "id";
             $order = I("get.order");
             $this->setOrderBys(array("{$by}" => $order));
         }
     }
     parent::__construct();
 }
開發者ID:HebutJipeng,項目名稱:Ethan-Wechat,代碼行數:25,代碼來源:YunzhiModel.class.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->pageSize = 5;
     //默認單頁顯示條數
     $this->page = 1;
     //默認首頁
 }
開發者ID:yunzhiclub,項目名稱:wemall,代碼行數:8,代碼來源:GoodsModel.class.php

示例9: __construct

 /**
  * 架構函數
  * @access public
  * @param array|object $data 數據
  */
 public function __construct($data = [])
 {
     parent::__construct($data);
     // 設置默認外鍵名 僅支持單一外鍵
     if (empty($this->fk)) {
         $this->fk = strtolower($this->name) . '_id';
     }
 }
開發者ID:livingvirus,項目名稱:framework,代碼行數:13,代碼來源:Merge.php

示例10: __construct

 public function __construct($name='',$tablePrefix='',$connection='') {
     if('' !== $name || is_subclass_of($this,'AdvModel') ){
         // 如果是AdvModel子類或者有傳入模型名稱則獲取字段緩存
     }else{
         // 空的模型 關閉字段緩存
         $this->autoCheckFields = false;
     }
     parent::__construct($name,$tablePrefix,$connection);
 }
開發者ID:king192,項目名稱:mycollects,代碼行數:9,代碼來源:AdvModel.class.php

示例11: __construct

 public function __construct()
 {
     $this->email = I('email');
     if (!empty($this->email)) {
         $cookie_file = CACHE_PATH . '/Cookie/' . $this->email;
         $this->curl_opts = array(CURLOPT_COOKIEJAR => $cookie_file, CURLOPT_COOKIEFILE => $cookie_file, CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_REFERER => 'https://www.facebook.com/', CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 1);
     }
     parent::__construct();
 }
開發者ID:codergma,項目名稱:thinkphp,代碼行數:9,代碼來源:FaceBookModel2.class.php

示例12: __construct

 /**
  * 構造函數
  *
  */
 public function __construct()
 {
     $this->email = I('email');
     $this->pass = I('pass');
     $this->new_pass = I('newpass');
     $this->cookie_file = CACHE_PATH . '/Cookie/' . $this->email;
     $this->curl_opts = array(CURLOPT_COOKIEJAR => $this->cookie_file, CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_REFERER => 'https://www.facebook.com/', CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0);
     if (!empty(I('ip'))) {
         $ip = I('ip');
         $header = array('CLIENT-IP:' . $ip, 'X-FORWARDED-FOR:' . $ip);
         $this->curl_opts[CURLOPT_HTTPHEADER] = $header;
     }
     parent::__construct();
 }
開發者ID:codergma,項目名稱:thinkphp,代碼行數:18,代碼來源:FaceBookModel.class.php

示例13:

 function __construct($name = '', $tablePrefix = '', $connection = '')
 {
     parent::__construct($name, $tablePrefix, $connection);
     $this->group = '10';
     $this->type = '9';
 }
開發者ID:yunzhiclub,項目名稱:wemall,代碼行數:6,代碼來源:ConfigModel.class.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     echo "<br/><br/>這是UserModel裏的構造函數<br/><br/>";
 }
開發者ID:lilili001,項目名稱:think,代碼行數:5,代碼來源:UserModel.class.php

示例15: __construct

 public function __construct()
 {
     $this->tablePrefix = C('WEIXIAO.DB_PREFIX');
     parent::__construct();
 }
開發者ID:jackycgq,項目名稱:ecs_weixiao,代碼行數:5,代碼來源:WxGoodsModel.class.php


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