dongtang5229 2010-10-15 11:41
浏览 47
已采纳

Zend Framework - 并非显示所有错误

In an action method, I have the following excerpt of code:

error_reporting(E_ALL);
ini_set('display_errors', '1');
Logger::log('test');

The Logger class is defined in this way:

class Logger {
    public static function log() {
        echo "test";
}

I deliberately forgot the closing brace of the function to demonstrate the problem. When the action is called, absolutely nothing is rendered on the screen. What type of error is this, and why is it not displayed, even though I configured PHP to show all errors, as shown above?

Of course, if I add the missing brace, everything is OK.

  • 写回答

2条回答 默认 最新

  • duangengruan2144 2010-10-15 12:09
    关注

    You also have to enable display_startup_errors to show Fatal errors:

    Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. It's strongly recommended to keep display_startup_errors off, except for debugging.

    Also see the Note for display_errors:

    Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

    You can set both values in Zend Framework's application.ini. On a sidenote: if you set error_reporting(-1) it will report (!display) all errors, including E_STRICT and any future additions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器