Php 致命错误:类';JDatabaseDriver';找不到
我已经在网上搜索这个问题的答案两天了。我花了很多时间在joomla论坛上,但我没有找到任何解决这个问题的方法。希望我能在这里找到一些方向 此错误在我访问网站时出现 但是,如果我输入http:/jensenlocksmithing.com/index.php,错误将再次消失。这对我来说真的很奇怪 以下是错误所指的代码块: /** *创建数据库对象 * *@return JDatabaseDriver * *@请参阅JDatabaseDriver *@自11.1 */ 受保护的静态函数createDbo() { $conf=self::getConfig() 我已尝试完全重新安装joomla安装来修复该问题,之后我清除了缓存,但仍然收到错误Php 致命错误:类';JDatabaseDriver';找不到,php,mysql,joomla,Php,Mysql,Joomla,我已经在网上搜索这个问题的答案两天了。我花了很多时间在joomla论坛上,但我没有找到任何解决这个问题的方法。希望我能在这里找到一些方向 此错误在我访问网站时出现 但是,如果我输入http:/jensenlocksmithing.com/index.php,错误将再次消失。这对我来说真的很奇怪 以下是错误所指的代码块: /** *创建数据库对象 * *@return JDatabaseDriver * *@请参阅JDatabaseDriver *@自11.1 */ 受保护的静态函数createD
任何建议都会有帮助。以下代码应该可以工作,这是我在Coppermine照片库图像模块中使用的代码:
$host = $conf->get('host');
$user = $conf->get('user');
$password = $conf->get('password');
$database = $conf->get('db');
$prefix = $conf->get('dbprefix');
$driver = $conf->get('dbtype');
$debug = $conf->get('debug');
$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
try
{
$db = JDatabaseDriver::getInstance($options);
}
catch (RuntimeException $e)
{
if (!headers_sent())
{
header('HTTP/1.1 500 Internal Server Error');
}
jexit('Database Error: ' . $e->getMessage());
}
$db->setDebug($debug);
return $db;
}
希望这能解决你的问题
$host = $conf->get('host');
$user = $conf->get('user');
$password = $conf->get('password');
$database = $conf->get('db');
$prefix = $conf->get('dbprefix');
$driver = $conf->get('dbtype');
$debug = $conf->get('debug');
$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
try
{
$db = JDatabaseDriver::getInstance($options);
}
catch (RuntimeException $e)
{
if (!headers_sent())
{
header('HTTP/1.1 500 Internal Server Error');
}
jexit('Database Error: ' . $e->getMessage());
}
$db->setDebug($debug);
return $db;
}
$config = JFactory::getConfig();
$option = array();
$option['driver'] = $config->get('dbtype');
$option['host'] = $config->get('host');
$option['user'] = $config->get('user');
$option['password'] = $config->get('password');
$option['database'] = $config->get('db');
$option['prefix'] = $config->get('dbprefix');
//UNCOMMENT THE FOLLOWING LINE TO VIEW OPTIONS ARRAY CONTENTS
//print_r($option);
$db = JFactory::getDBO();
try
{
$db = JDatabase::getInstance($option);
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage());
$db->setDebug($debug);
return false;
}
return $db;