我在 Codeigniter 中连接数据库时遇到问题,因为我的数据库名称是“database-db_sample”,所以我想知道我的数据库名称中的 -(hypen) 是否是我出错的原因,
这是我得到的错误
发生数据库错误
无法选择指定的数据库:database-db_sample
谁能告诉我我做错了什么,这是我的数据库配置
$db['online']['hostname'] = "localhost";
$db['online']['username'] = "root";
$db['online']['password'] = "";
$db['online']['database'] = "database-db_sample";
$db['online']['dbdriver'] = "mysql";
$db['online']['dbprefix'] = "";
$db['online']['pconnect'] = TRUE;
$db['online']['db_debug'] = TRUE;
$db['online']['cache_on'] = FALSE;
$db['online']['cachedir'] = "";
$db['online']['char_set'] = "utf8";
$db['online']['dbcollat'] = "utf8_general_ci";
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;