zoukankan      html  css  js  c++  java
  • php输出错误信息

    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");
    

     最好放在最前面,如果报错就终止了,就无法执行这个方法

  • 相关阅读:
    CSP2018-09
    CSP2018-03
    CSP2017-12
    CSP2017-09
    CSP2017-03
    CSP2016-12
    [算法设计与分析] 奶酪 (并查集)
    5555
    阿超
    结对作业
  • 原文地址:https://www.cnblogs.com/anxiaoyu/p/7657342.html
Copyright © 2011-2022 走看看