set_exception_handler 自定义异常处理

set_exception_handler 自定义异常处理

  1. function exception_handler($exception) {  
  2.   echo "Uncaught exception: " , $exception->getMessage(), "/n";  
  3. }  
  4. set_exception_handler('exception_handler');  
  5. throw new Exception('Uncaught Exception');  
  6. echo "Not Executed/n";

set_exception_handler就是设置了一下,当你的程序需要抛出一个异常的时候调用哪个自定义的函数。 

原文地址:https://www.cnblogs.com/jamesbd/p/3729989.html