restore_exception_handler

(PHP 5, PHP 7)

restore_exception_handler 锟街革拷之前锟斤拷锟斤拷锟斤拷锟斤拷斐o拷锟斤拷锟斤拷锟斤拷锟�

说锟斤拷

restore_exception_handler ( void ) : bool

锟斤拷使锟斤拷 set_exception_handler() 锟侥憋拷锟届常锟斤拷锟斤拷锟斤拷之锟襟,此猴拷锟斤拷锟斤拷锟斤拷 锟斤拷锟节伙拷原之前锟斤拷锟届常锟斤拷锟斤拷锟斤拷锟�(锟斤拷锟斤拷锟斤拷锟斤拷锟矫的伙拷锟斤拷也锟斤拷锟斤拷锟斤拷锟矫伙拷锟斤拷锟斤拷锟斤拷暮锟斤拷锟�)锟斤拷

锟斤拷锟斤拷值

锟矫猴拷锟斤拷锟斤拷锟角凤拷锟斤拷 TRUE锟斤拷

锟斤拷锟斤拷

Example #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...

锟轿硷拷

  • set_exception_handler() - 锟斤拷锟斤拷锟矫伙拷锟皆讹拷锟斤拷锟斤拷斐o拷锟斤拷锟斤拷锟�
  • set_error_handler() - 锟斤拷锟斤拷锟矫伙拷锟皆讹拷锟斤拷拇锟斤拷锟斤拷锟斤拷锟�
  • restore_error_handler() - 锟斤拷原之前锟侥达拷锟斤拷锟斤拷锟斤拷
  • error_reporting() - 锟斤拷锟斤拷应锟矫憋拷锟斤拷锟斤拷锟� PHP 锟斤拷锟斤拷