本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦
在php中,我們可以使用錯(cuò)誤控制運(yùn)算符@
或error_reporting()函數(shù)屏蔽單行或者單個(gè)文件,但要如何屏蔽所有錯(cuò)誤呢?下面給大家介紹一下。
php忽略所有錯(cuò)誤的方法
1、進(jìn)入PHP安裝目錄,找到并打開 php.ini 配置文件
2、搜索 display_errors
3、然后將 display_errors 的值設(shè)置為 Off 即可關(guān)閉所有的 PHP 錯(cuò)誤報(bào)告。
如下所示:
; 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
推薦學(xué)習(xí):《PHP視頻教程》