restore_exception_handler функциясы
restore_exception_handler функциясы set_exception_handler көмегімен ауыстырылған
алдыңғы ерекше жағдайлар өндегішін қалпына келтіреді. Бұл функция параметрлерді қабылдамайды
және мән қайтармайды.
Синтаксис
restore_exception_handler();
Мысал
Пайдаланушының ерекше жағдайлар өндегішін орнатайық, содан кейін алдыңғыны қалпына келтірейік:
<?php
function customExceptionHandler($exception) {
echo 'Custom handler: ' . $exception->getMessage();
}
set_exception_handler('customExceptionHandler');
restore_exception_handler();
?>
Мысал
Қалпына келтіруден кейін стандартты механизм жұмыс істейтінін тексерейік:
<?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');
?>
Кодты орындау нәтижесі:
'Handler 1: Test error'