本文整理匯總了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);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->logerSer = D('Log', 'Service');
$this->userSer = D('User', 'Service');
$this->toolkitSer = D('ToolKit', 'Service');
}
示例3: __construct
/**
* 根據userid初始化模型實際的數據表
*/
public function __construct($userid)
{
if (intval($userid) > 0) {
$this->tableName = 'user_errquestion_' . spf_table($userid);
}
parent::__construct($this->tableName);
}
示例4: __construct
/**
* 根據userid初始化模型實際的數據表
*/
public function __construct($qid)
{
if (intval($qid) > 0) {
$this->tableName = 'user_notes_' . spf_table($qid);
}
parent::__construct($this->tableName);
}
示例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';
}
}
示例6: __construct
public function __construct()
{
parent::__construct();
$this->logerSer = D('Log', 'Service');
$this->toolkitSer = D('ToolKit', 'Service');
$this->redisSer = new RedisSetService();
}
示例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();
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->pageSize = 5;
//默認單頁顯示條數
$this->page = 1;
//默認首頁
}
示例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';
}
}
示例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);
}
示例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();
}
示例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();
}
示例13:
function __construct($name = '', $tablePrefix = '', $connection = '')
{
parent::__construct($name, $tablePrefix, $connection);
$this->group = '10';
$this->type = '9';
}
示例14: __construct
public function __construct()
{
parent::__construct();
echo "<br/><br/>這是UserModel裏的構造函數<br/><br/>";
}
示例15: __construct
public function __construct()
{
$this->tablePrefix = C('WEIXIAO.DB_PREFIX');
parent::__construct();
}