PHP error_reporting()関数
例
別のエラーレベルレポートを指定します。
<?php
// Turn off error reporting
error_reporting(0);
// Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Report all errors
error_reporting(E_ALL);
// Same as error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
?>
定義と使用法
error_reporting()関数は、報告されるエラーを指定します。
PHPには多くのレベルのエラーがあり、この関数を使用すると、現在のスクリプトにそのレベルが設定されます。
構文
error_reporting(level);
パラメータ値
Parameter | Description |
---|---|
level | Optional. Specifies the error-report level for the current script. Error numbers and named constants are accepted. Note: Named constants are recommended to ensure compatibility for future PHP versions |
技術的な詳細
戻り値: | レベルパラメータが指定されていない場合は、古いエラーレポートレベルまたは現在のエラーレポートレベルを返します |
---|---|
PHPバージョン: | 4.0以降 |
PHP変更ログ: | PHP 5.4:E_STRICTがE_ALLの一部になりました。 PHP 5.3:新規:E_DEPRECATEDおよびE_USER_DEPRECATED。 PHP 5.2:新規:E_RECOVERABLE_ERROR。 PHP 5.0:新規:E_STRICT。 |
PHPエラーリファレンス