restore_exception_handler

(PHP 5, PHP 7, PHP 8)

restore_exception_handler — 이전에 정의된 예외 처리기 함수를 복원합니다.


설명

restore_exception_handler(): bool

set_exception_handler()를 사용하여 예외 처리기 함수를 변경한 후 이전 예외 처리기로 되돌리는 데 사용됩니다(내장 또는 사용자 정의 함수일 수 있음).


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

이 함수는 항상 true를 반환합니다.


Examples

예제 #1 restore_exception_handler() 예제

                  
<?php
    function exception_handler_1(Exception $e)
    {
        echo '[' . __FUNCTION__ . '] ' . $e->getMessage();
    }

    function exception_handler_2(Exception $e)
    {
        echo '[' . __FUNCTION__ . '] ' . $e->getMessage();
    }

    set_exception_handler('exception_handler_1');
    set_exception_handler('exception_handler_2');

    restore_exception_handler();

    throw new Exception('This triggers the first exception handler...');
?>
                  
                

위의 예는 다음을 출력합니다.

[exception_handler_1] This triggers the first exception handler...
                

기타