tp3.2 连接两个数据库

其实还是比想象简单很多的。手册也有,但是还是要记录一下。

配置文件

'DB_CONFIG1' => array(
    'db_type'  => 'mysql',
    'db_user'  => 'root',
    'db_pwd'   => '1234',
    'db_host'  => 'localhost',
    'db_port'  => '3306',
    'db_name'  => 'thinkphp',
    'db_charset'=>    'utf8',
),

调用

$User = M('User','other_','DB_CONFIG2');

这样就可以了。足够了。

猜你喜欢

转载自my.oschina.net/u/3660147/blog/1786784