如何在CodeIgniter中连接两个数据库服务器,即一个本地服务器和另一个实时服务器? 1个本地服务器 还有1个服务器直播
如何在CodeIgniter中连接两个数据库服务器,即一个本地服务器和另一个实时服务器? 1个本地服务器 还有1个服务器直播
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
//'username' => 'skyware',
//'password' => 'skyware',
'username' => 'root',
'password' => '',
//'database' => 'zadmin_kagum',
'database' => 'zadmin_afung',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$active_group = 'cloud';
$query_builder = TRUE;
$db['cloud'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'afungdbuser',
'password' => 'IQGCnqsK9',
'database' => 'zadmin_afungdb',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

db_cloud是服务器实时的,默认服务器是本地的
答案 0 :(得分:0)
当您使用本地保留$active_group = 'default';
中的代码时。将代码移动到实时更改$active_group = 'cloud';
时。检查它可能会对你有所帮助。