0

我的网站在 2-3 周前正常运行,现在它给了我一个错误,例如: joomla fatal error class 'JError' not found 。当我输入 URL 时,它显示以下错误消息...致命错误:第 565 行的 /home/dcmops/public_html/gu/libraries/joomla/factory.php 中找不到类“JError”

我什至看不到管理选项卡,它也显示相同的错误。任何人都可以指导我解决这个问题...??

代码@第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;

谢谢和问候, 拉胡尔

4

1 回答 1

0

如果您使用的是 Joomla 1.5,这将正常工作。否则,您需要使用标准异常。

您可以使用通用功能自动处理所有 Joomla 版本。

前任:

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);
  }
}

现在您可以像 JError 一样抛出异常。

例如

SomeClassName::throw_error(500, 'An exception occurred');
于 2013-06-08T10:50:36.233 回答