| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
8年前发布

自定义 php 错误捕获代码

<?php  /**   * @Author: yangyulong   * @Date:   2015-12-28 22:09:22   * @Last Modified by:   yangyulong   * @Last Modified time: 2015-12-28 22:48:49   */  error_reporting(0);  //注册错误捕捉函数  register_shutdown_function('jd_fatal_error');    //注册错误处理函数  set_error_handler('jd_error_handler');    function jd_fatal_error(){   if ($e = error_get_last()) {    switch ($e['type']) {     case E_ERROR:     case E_PARSE:     case E_CORE_ERROR:     case E_COMPILE_ERROR:     case E_USER_ERROR:     //所有测错误类型都用下面的函数同意捕获       jd_error_handler($e['type'], $e['message'], $e['file'], $e['line']);     break;    }   }  }    /**   * 捕获错误的函数   *   * @method jd_error_handler   *   * @param  [type]           $type    [description]   * @param  [type]           $message [description]   * @param  [type]           $file    [description]   * @param  [type]           $line    [description]   *   * @return [type]                    [description]   */  function jd_error_handler($type, $message, $file, $line){   echo '<b>'.$type.':'.$message.' in '.$file.' on '.$line. ' line .</b><br />';  }    print_r(xx());    // print_r(debug_backtrace());  // print_r(debug_print_backtrace());



来自: http://my.oschina.net/anziguoer/blog/552551

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1451369262683.html
PHP开发