本文整理汇总了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();
}