error_reporting(E_ALL);function cache_shutdown_error() { ?????????$_error = error_get_last(); ?????????if ($_error && in_array($_error[‘type‘], array(1, 4, 16, 64, 256, 4096, E_ALL))) { ???????????????????header("Content-Type: text/html; charset=utf-8"); ???????????????????echo ‘<font color=red>你的代码出错了:</font></br>‘; ???????????????????echo ‘致命错误:‘ . $_error[‘message‘] . ‘</br>‘; ???????????????????echo ‘文件:‘ . $_error[‘file‘] . ‘</br>‘; ???????????????????echo ‘在第‘ . $_error[‘line‘] . ‘行</br>‘; ???????????????} ???????????} register_shutdown_function("cache_shutdown_error");
最好放在最前面,如果报错就终止了,就无法执行这个方法
php输出错误信息
原文地址:http://www.cnblogs.com/anxiaoyu/p/7657342.html