我对 Kohana 3.3 和使用不同的数据库配置有疑问。我有一个带有“默认”配置和“其他”的 config/database.php,如下所示:
return array
(
'default' => array
(
'type' => 'MySQL',
'connection' => array(
'hostname' => 'localhost',
'database' => 'database-one',
'username' => 'root',
'password' => 'password',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
),
'other' => array
(
'type' => 'MySQL',
'connection' => array(
'hostname' => 'localhost',
'database' => 'database-two',
'username' => 'root',
'password' => 'password',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
));
但是在尝试使用时在控制器或模型中:
Database::instance('other');
Kohana 仍将使用“默认”配置。我究竟做错了什么?
谢谢!