PHP restore_exception_handler() Functie
Voorbeeld
Voorbeeld van een uitzonderingshandler herstellen:
<?php
// Two user-defined exception handler functions
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();
// Throw exception
throw new Exception("This triggers the first exception handler...");
?>
Definitie en gebruik
De functie restore_exception_handler() herstelt de vorige uitzonderingshandler.
Deze functie wordt gebruikt om de vorige uitzonderingshandler te herstellen nadat deze is gewijzigd met de functie set_exception_handler() .
Tip: De vorige uitzonderingshandler kan de ingebouwde uitzonderingshandler zijn of een door de gebruiker gedefinieerde uitzonderingshandlerfunctie.
Syntaxis
restore_exception_handler();
Technische details
Winstwaarde: | Altijd waar |
---|---|
PHP-versie: | 5.0+ |
PHP-foutreferentie