在一种操作方法中,我具有以下代码摘录:
error_reporting(E_ALL);
ini_set('display_errors', '1');
Logger::log('test');
Logger类的定义方式如下:
class Logger {
public static function log() {
echo "test";
}
我故意忘记了函数的右括号来演示该问题.调用该动作时,屏幕上绝对不会呈现任何内容.这是什么类型的错误,即使我将PHP配置为显示所有错误,也为什么不显示它,如上所示?
当然,如果我添加缺少的括号,一切都很好.
解决方法:
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.
另请参见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.
您可以在Zend Framework的application.ini中设置两个值.在旁注:如果设置error_reporting(-1),它将报告(!显示)所有错误,包括E_STRICT和任何将来的添加.
标签:php,zend-framework
来源: https://codeday.me/bug/20191012/1898619.html