settings.php节选:
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => '192.168.100.1',
'port' => 3306,
'prefix' => '',
'collation' => 'utf8_general_ci',
);
$databases['custom_db']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => '192.168.100.2',
'port' => 3306,
'prefix' => '',
'collation' => 'utf8_general_ci',
);
数据库切换代码:
db_set_active('cutome_db');
板块
Drupal 版本