PHP error_reporting() Functie
Voorbeeld
Specificeer verschillende foutniveaurapportage:
<?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);
?>
Definitie en gebruik
De functie error_reporting() geeft aan welke fouten worden gerapporteerd.
PHP heeft veel foutenniveaus en met deze functie wordt dat niveau voor het huidige script ingesteld.
Syntaxis
error_reporting(level);
Parameterwaarden
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 |
Technische details
Winstwaarde: | Retourneert het oude foutrapportageniveau of het huidige foutrapportageniveau als er geen niveauparameter is opgegeven |
---|---|
PHP-versie: | 4.0+ |
PHP-wijzigingslogboek: | PHP 5.4: E_STRICT is nu een onderdeel van E_ALL. PHP 5.3: Nieuw: E_DEPRECATED en E_USER_DEPRECATED. PHP 5.2: Nieuw: E_RECOVERABLE_ERROR. PHP 5.0: Nieuw: E_STRICT. |
PHP-foutreferentie