php的debug相关函数用法示例

原创 2017-01-03 13:08:34 654
摘要:本文实例讲述了php的debug相关函数用法。分享给大家供大家参考,具体如下:loginfo函数:function loginfo($format) {   $args = func_get_args();   array_shift($args);   $d = debug_b

本文实例讲述了php的debug相关函数用法。分享给大家供大家参考,具体如下:

loginfo函数:

function loginfo($format) {
  $args = func_get_args();
  array_shift($args);
  $d = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1)[0];
  $info = vsprintf($format, $args);
  $data = sprintf("%s %s,%d: %s\n", date("Ymd His"), $d["file"], $d["line"], $info);
  file_put_contents(__DIR__."/log.txt", $data, FILE_APPEND);
}

 更多关于php的debug相关函数用法示例请关注PHP中文网(www.php.cn)其它文章!  


发布手记

热门词条