protected $dbName = 'top';
$User = D('User');
protected $connection = 'mysql://root:1234@localhost:3306/thinkphp';
protected $connection = array( 'db_type' => 'mysql', 'db_user' => 'root', 'db_pwd' => '1234', 'db_host' => 'localhost', 'db_port' => '3306', 'db_name' => 'thinkphp' );
//数据库配置1
'DB_CONFIG1' = array(
'db_type' => 'mysql',
'db_user' => 'root',
'db_pwd' => '1234',
'db_host' => 'localhost',
'db_port' => '3306',
'db_name' => 'thinkphp'
),
//数据库配置2
'DB_CONFIG2' => 'mysql://root:1234@localhost:3306/thinkphp';
//调用配置文件中的数据库配置1 protected $connection = 'DB_CONFIG1';
//调用配置文件中的数据库配置2 protected $connection = 'DB_CONFIG2';
$User = new Model('User','think_','mysql://root:1234@localhost/thinkphp');
$User = M('User','think_','mysql://root:1234@localhost/thinkphp');
$User = M('User','think_','DB_CONFIG2');
$User = M('top.User','think_');
$User = M('top.User',null);
Model->db("数据库编号","数据库配置");
$this->db(1,"mysql://root:123456@localhost:3306/test")->query("查询SQL");
$this->db(1)->query("查询SQL");
$this->db(0);
$this->db(1,"DB_CONFIG1")->query("查询SQL");
$this->db(2,"DB_CONFIG2")->query("查询SQL");
$this->db(1)->table("top_user")->find();
$db = $this->db();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有