PHPのすべてのエラーを無視する方法

青灯夜游
リリース: 2023-03-13 08:40:02
オリジナル
2235 人が閲覧しました

このチュートリアルの動作環境: Windows 7 システム、PHP バージョン 7.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 中国語 Web サイトの他の関連記事を参照してください。

関連ラベル:
php
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!