[英]Fatal error class 'JError' not found
My website was running correctly before 2-3 weeks and now it gives me an error like: joomla fatal error class 'JError' not found . 我的网站在2-3周前运行正常,现在给我一个错误,例如:joomla致命错误类'JError'未找到。 when i am typing the URL it shows the following error message... Fatal error: Class 'JError' not found in /home/dcmops/public_html/gu/libraries/joomla/factory.php on line 565
当我键入URL时,它显示以下错误消息...致命错误:在第565行的/home/dcmops/public_html/gu/libraries/joomla/factory.php中找不到类'JError'
I am even not able to see the admin tab, it also shows the same error. 我什至看不到管理标签,它也显示相同的错误。 Can anybody guide me regarding this issue...??
关于这个问题,有人可以指导我吗??
the code @ line 565 is as follows @ 565行的代码如下
if ( JError::isError($db) ) {
header('HTTP/1.1 500 Internal Server Error');
jexit('Database Error: ' . $db->toString() );
}
if ($db->getErrorNum() > 0) {
JError::raiseError(500 , 'JDatabase::getInstance: Could not connect to database <br />' . 'joomla.library:'.$db->getErrorNum().' - '.$db->getErrorMsg() );
}
$db->debug( $debug );
return $db;
Thanks & Regards, Rahul 谢谢与问候,拉胡尔
If you are using Joomla 1.5, this will work fine. 如果您使用的是Joomla 1.5,则可以正常运行。 Otherwise you need to use standard Exceptions.
否则,您需要使用标准异常。
You can use a common function to handle all Joomla versions automatically. 您可以使用通用功能自动处理所有Joomla版本。
Ex: 例如:
defined('APP_VERSION') or (version_compare(JVERSION,'1.6.0','ge') ? define('APP_VERSION', 2.5) : define('APP_VERSION', 1.5));
public static function throw_error($code, $msg){
if(APP_VERSION == '1.5'){
JError::raiseError( $code, $msg);
}else{
throw new Exception($msg, $code);
}
}
Now you can throw exception just like JError. 现在,您可以像JError一样引发异常。
eg 例如
SomeClassName::throw_error(500, 'An exception occurred');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.