Skip to content

Instantly share code, notes, and snippets.

@yuktse
Created March 6, 2014 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuktse/9385161 to your computer and use it in GitHub Desktop.
Save yuktse/9385161 to your computer and use it in GitHub Desktop.
qeephp model连接不同DB,及不同服务器的DB
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