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

前端 未结 17 2317
北荒
北荒 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:49

    Here is just a nice trick to get the current error_handler method =)

    
    

    Also I want to note that if you call

    
    

    PHP stops displaying the error. Otherwise, the error text will be send to the client prior to your error handler.

提交回复
热议问题