【问题标题】:Joomla backend disable eerror reporting in my componentJoomla 后端在我的组件中禁用错误​​报告
【发布时间】:2018-06-27 03:10:21
【问题描述】:

我正在为后端开发一个 joomla 组件。现在为了调试,我只需将die() 放在我需要停止的地方并一直显示调试信息以弄清楚会发生什么。我没有使用 XDEBUG,因为有很多查询,我需要一次检查很多结果。

但我有一个问题。当我的 SQL 查询出错时,因为脚本中的一些错误或我的错误,只需将其放在 Joomla 返回的所有其他信息的底部,例如页面: /administrator/index.php?option=com_xyz&view=build 到 /administrator/ 删除了所有调试信息,所以我无法弄清楚错误发生在哪里或哪个 SQL 查询导致了这个问题。

所以我在红色块内的顶部主管理页面上有类似的错误:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3

我想要的只是它没有捕获错误并允许我在其他脚本输出中看到它。

那么如何在我的组件中暂时禁用 joomla 报告。

【问题讨论】:

    标签: php error-handling joomla components backend


    【解决方案1】:

    我首先使用:

    restore_exception_handler();
    

    然后

    try {
         $dict_data = $db->loadObject();
    }
    catch (Exception $e){
        $trace = $e->getTrace();
        echo $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine().' called from '.$trace[0]['file'].' on line '.$trace[0]['line'];
        die();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-30
      • 2014-01-13
      • 2013-05-31
      • 2010-11-11
      • 1970-01-01
      • 1970-01-01
      • 2014-06-16
      • 1970-01-01
      相关资源
      最近更新 更多