在我的模型文件中,我尝试放置此代码,但不起作用。出了什么问题?
php_error.log中的致命错误:在...中找不到“JDatabaseDriver”类
protected function getListQuery()
{
//$db = $this->getDbo();
//$query = $db->getQuery(true);
$option = array();
$option['driver'] = 'mssql';
$option['host'] = '10.10.10.9';
$option['user'] = 'lubo';
$option['password'] = 'lubo';
$option['database'] = 'vladka';
$option['prefix'] = '';
$db = JDatabaseDriver::getInstance( $option );
$query = $db->getQuery(true);
$query->select('*');
$query->from('dbo.vyrobky');
return $query;
}
答案 0 :(得分:0)
正如@Cesar所指出的,Joomla 2.5中没有类JDatabaseDriver。您必须直接实例 JDatabaseSQLSrv 类
protected function getListQuery()
{
$option = array();
$option['host'] = '10.10.10.9';
$option['user'] = 'lubo';
$option['password'] = 'lubo';
$option['database'] = 'vladka';
$option['prefix'] = '';
$db = new JDatabaseDriverSQLSrv($option);
$query = $db->getQuery(true);
$query->select('*');
$query->from('dbo.vyrobky');
return $query;
}