Created
March 6, 2014 08:45
-
-
Save yuktse/9385161 to your computer and use it in GitHub Desktop.
qeephp model连接不同DB,及不同服务器的DB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 首先是同服务器的不同DB | |
在模型的__define() 里面增加 | |
'table_config' => array( | |
'schema' => 'dbname', | |
), | |
2. 其次是不同服务器的DB | |
这就要在database.yaml.php增加 | |
new_dsn: | |
driver: mysql | |
host: 192.168.x.x | |
login: xxxx | |
password: xxxx | |
database: xxxx | |
charset: utf8 | |
prefix: | |
然后上面的table_config改为 | |
'table_config' => array( | |
'conn' => QDB::getConn('new_dsn') | |
), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment