本教學操作環境: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中文網其他相關文章!