在非Kohana应用中是否有一种简单的方法来使用Kohana DB配置文件?我似乎无法通过阅读Kohana_Config类来了解它。在非Kohana应用中使用Kohana配置文件
为什么?假设我有一个位于同一个目录中的cron任务,并且我希望它使用相同的数据库配置。
这个愚蠢的尝试在失败告终......
function connection(){
$connection = file_get_contents('../application/config/database.php');
eval($connection);
}
下面是配置的一个样本:
return array
(
'default' => array
(
'type' => 'mysql',
'connection' => array(
'hostname' => 'localhost',
'database' => 'some_db',
'username' => 'root',
'password' => 'root',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
'profiling' => TRUE,
),
完美!谢谢! – Serhiy