PHP restore_exception_handler() functie
Voorbeeld
Herstel uitzonderingsafhandlingsprogramma:
<?php // Twee gebruikersgedefinieerde uitzonderingsafhandlingsfuncties function myException1($exception) { echo "[" . __FUNCTION__ . "]" . $exception->getMessage(); } function myException2($exception) { echo "[" . __FUNCTION__ . "]" . $exception->getMessage(); } set_exception_handler("myException1"); set_exception_handler("myException2"); restore_exception_handler(); // Uitzondering gooien throw new Exception("This triggers the first exception handler..."); ?>
De output van het bovenstaande code lijkt erop:
[myException1] Dit triggert de eerste uitzonderingsafhandlingsfunctie...
Definitie en gebruik
restore_exception_handler() functie herstelt de eerdere uitzonderingsafhandlingsprogramma's.
Na het wijzigen van de uitzonderingsafhandlingsfunctie met set_exception_handler(), kan deze functie worden gebruikt om de eerdere uitzonderingsafhandlingsprogramma's te herstellen.
Tip:De eerdere uitzonderingsafhandlingsfunctie kan ingebouwd zijn of ook door de gebruiker gedefinieerd zijn.
Syntax
restore_exception_handler();
Technische details
Retourwaarde: | Altijd TRUE retourneren. |
---|---|
PHP Versie: | 5.0+ |