1

In production I don't want to show the following error:

<b>Warning</b>:  POST Content-Length of 25633071 bytes exceeds the limit of 20971520 bytes in <b>Unknown</b> on line <b>0</b><br />

error_reporting is set to 0...

error_reporting(0);

But I'm still getting the error. How can I suppress this error so I can display my own error page?

The error messages are handled by exceptions

4

2 回答 2

3

ini_set('error_reporting')在这种情况下不起作用,因为错误发生在脚本执行之前。

所以你必须在 php.ini 中设置它。

但是不要禁用错误报告,错误对你来说非常有用。

对用户隐藏它们就足够了(并且推荐)。您可以通过在 php.ini 中设置display_errors为来实现。0然后启用log_errors.

于 2013-05-24T16:38:24.410 回答
0

使用波浪号将停止某种类型的错误 - 该指令对我有用,可以停止显示警告:

(php.ini 的第 514 行) error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE

于 2013-05-24T16:37:41.357 回答