如何攔截到 php 的 notice, warning 錯誤?

Notice: Undefined property: stdClass::$xxx in /Applications/xxx/xxx/xxx/xxx.php on line 35

Warning: Invalid argument supplied for foreach() in /Applications/xxx/xxx/xxx/xxx.php on line 35

上面類似這種的錯誤
要如何能夠攔截呢?
如果可以的話我想改成自己的解釋
用戶看到也不會怪

守候你守候我
浏览 337回答 2
2回答

斯蒂芬大帝

set_error_handler,set_exception_handler,register_shutdown_function这三个方法,可以找各种框架看看他们的错误异常接管,也可以用whoops这种现成的类库。
打开App,查看更多内容
随时随地看视频慕课网APP