PHP错误报告按需(PHP Error reporting on demand)

系统教程 行业动态 更新时间:2024-06-14 17:03:54
PHP错误报告按需(PHP Error reporting on demand)

在PHP中,如何使它在使用error_reporting()函数时才显示错误。 目前,IIS PHP应用程序设置为“生产计算机”。 如果我将其更改为开发机器,它将打印出所有错误,即使没有error_reporting()。

In PHP how do you make it so that it will only display errors when using the error_reporting() function. Currently the IIS PHP application is set to 'Production machine'. If I change it to Development machine it will print out all errors even without error_reporting().

最满意答案

您可以通过应用程序设置error_reporting并覆盖php.ini设置。

无论如何,你永远不应该把它关掉。

相反,在php.ini或代码中将display_errors更改为Off :

ini_set('display_errors', 0);

I got the behavior I wanted using:

error_reporting(E_ALL); ini_set('display_errors', 1);

更多推荐

本文发布于:2023-04-24 14:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/df260ac728af9389f3eb3d6a165a92bd.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误报告   按需   PHP   demand   reporting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!