Restore_exception_handler funksiýasy
restore_exception_handler funksiýasy, set_exception_handler bilen çalşyrylan öňki ýalňyşlyk işleýjisini
dikeldýär. Bu funksiýa hiç hili parametrleri kabul etmeýär we hiç zat
yzyna gaýtarmaz.
Sintaksis
restore_exception_handler();
Mysal
Ulanyjy ýalňyşlyk işleýjisini gurnaýaly, soňra bolsa öňküsi dikeldeli:
<?php
function customExceptionHandler($exception) {
echo 'Custom handler: ' . $exception->getMessage();
}
set_exception_handler('customExceptionHandler');
restore_exception_handler();
?>
Mysal
Dikeldilenden soň işleýjiniň standart mehanizmi işleýändigini barlaýaly:
<?php
set_exception_handler(function($exception) {
echo 'Handler 1: ' . $exception->getMessage();
});
set_exception_handler(function($exception) {
echo 'Handler 2: ' . $exception->getMessage();
});
restore_exception_handler();
throw new Exception('Test error');
?>
Kody ýerine ýetirmegiň netijesi:
'Handler 1: Test error'