跳转到主要内容
dustise 提交于 19 November 2014

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 版本