• 技术文章 >后端开发 >PHP问题

    php怎么忽略所有错误

    青灯夜游青灯夜游2021-10-12 14:28:59原创98
    本教程操作环境:windows7系统、PHP7.1版、DELL G3电脑

    在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-errors
    display_errors = Off

    推荐学习:《PHP视频教程

    以上就是php怎么忽略所有错误的详细内容,更多请关注php中文网其它相关文章!

    声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
    专题推荐:php 忽略所有错误
    上一篇:php怎么将一维数组转换成字符串 下一篇:php.ini中如何设置错误级别
    线上培训班

    相关文章推荐

    • php怎么过滤字符串只获取数字• 聊聊PHP中如果让字符串直接解析函数(技巧分享)• php中长连接和短连接的区别是什么• php怎么计算指定日期是一年中的第几周• 深入浅析PHP中各种各样的接参形式

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网