2013-11-14 45 views
0

我有錯誤「您的應用程序/ config/database.php文件似乎不包含有效的配置數組。當負載配置數據庫中的笨:Codeigniter PHP:在控制器中加載配置數據庫時出錯?

這裏我的控制器:

$this->config->load('database'); 

這裏我的文件database.php中:

$active_group = 'default'; 
$active_record = TRUE; 
$tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) 
     (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))'; 
$db['default']['hostname'] = $tnsname; 
$db['default']['username'] = 'system'; 
$db['default']['password'] = 'xxxxxx'; 
$db['default']['database'] = ''; 
$db['default']['dbdriver'] = 'oci8'; 
$db['default']['dbprefix'] = ''; 
$db['default']['pconnect'] = TRUE; 
$db['default']['db_debug'] = TRUE; 
$db['default']['cache_on'] = FALSE; 
$db['default']['cachedir'] = ''; 
$db['default']['char_set'] = 'utf8'; 
$db['default']['dbcollat'] = 'utf8_general_ci'; 
$db['default']['swap_pre'] = ''; 
$db['default']['autoinit'] = TRUE; 
$db['default']['stricton'] = FALSE; 

我加載配置文件數據庫,我想改變控制器配置數據庫?會知道該怎麼做?

+0

這可能會幫助你http://ellislab.com/codeigniter/用戶導/數據庫/ configuration.html –

回答

2

請在database.php中(用於$db['default']['database'])指定數據庫名,並在控制器中提到$this->config->load('database_name')你在配置文件中已經設置

相關問題