在php中,我们可以使用错误控制运算符@或error_reporting()函数屏蔽单行或者单个文件,但要如何屏蔽所有错误呢?下面给大家介绍一下。
php忽略所有错误的方法
1、进入php安装目录,找到并打开 php.ini 配置文件
2、搜索 display_errors
3、然后将 display_errors 的值设置为 off 即可关闭所有的 php 错误报告。
如下所示:
; this directive controls whether or not and where php will output errors,; notices and warnings too. error output is very useful during development, but; it could be very dangerous in production environments. depending on the code; which is triggering the error, sensitive information could potentially leak; out of your application such as database usernames and passwords or worse.; for production environments, we recommend logging errors rather than; sending them to stdout.; possible values:; off = do not display any errors; stderr = display errors to stderr (affects only cgi/cli binaries!); on or stdout = display errors to stdout; default value: on; development value: on; production value: off; http://php.net/display-errorsdisplay_errors = off
推荐学习:《php视频教程》
以上就是php怎么忽略所有错误的详细内容。