Thinkphp3.2.3 多数据库配置
同时需要连接多个数据库时,配置及使用方法。
return array(
'DB_DSN' =>
'mysql://root:123456@192.168.3.237:3306/test',
'model2' =>
array(
'DB_TYPE' =>
'mysql',
'DB_HOST' =>
'192.168.3.237',
'DB_NAME' =>
'test1',
'DB_USER' =>
'root',
'DB_PWD' =>
'123465',
'DB_PORT' =>
3306,
'DB_CHARSET' =>
'utf8',
),
);
在控制器中调用的方式为
$m = M(
'file');
$file = M(
'file',
'',
'model2');
转载请注明原文地址: https://www.6miu.com/read-49083.html