我需要创建 Joomla 数据库配置的自定义数组,所以我这样做:
$config =& JFactory::getConfig();
$db['default']['hostname'] = $config->getValue('config.host');
但得到一个错误:Fatal error: Cannot use object of type JDatabaseMySQLi as array in /Sites/joomla/administrator/components/com_***** on line 217
。
我也试过这样:
die(var_dump($config->getValue('config.host')));
//string(9) "localhost"
$temp_var = $config->getValue('config.host');
die(var_dump($temp_var));
//string(9) "localhost"