How do I catch a PHP fatal (`E_ERROR`) error?

前端 未结 17 2269
北荒
北荒 2020-11-21 06:21

I can use set_error_handler() to catch most PHP errors, but it doesn\'t work for fatal (E_ERROR) errors, such as calling a function that doesn\'t e

17条回答
  •  囚心锁ツ
    2020-11-21 06:57

    If you are using PHP >= 5.1.0 Just do something like this with the ErrorException class:

    
    

提交回复
热议问题