php register_shutdown_function响应error 配合error_get_last 捕获错误
Posted dongruiha
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php register_shutdown_function响应error 配合error_get_last 捕获错误相关的知识,希望对你有一定的参考价值。
转自:
http://blog.csdn.net/a757291228/article/details/62231125
//一个函数,用来响应 register_shutdown_function function shutdownCallback($logPath=‘/tmp/z.log‘){ $arrError = error_get_last(); //使用 error_get_last 能捕获错误,等下说明 $date = date(‘Y-m-d H:i:s‘, time()); file_put_contents($logPath, "[".$date."]".var_export($arrError, true)."\r\n", FILE_APPEND); } register_shutdown_function("shutdownCallback");//如果出现错误则执行 shutdownCallback 触发器一样的存在 $b = new aa(); // 错误的代码
以上是关于php register_shutdown_function响应error 配合error_get_last 捕获错误的主要内容,如果未能解决你的问题,请参考以下文章
IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?