Skip to content

Instantly share code, notes, and snippets.

@bjzhush
Created May 22, 2016 09:39
Show Gist options
  • Save bjzhush/78348ce7bf039c9ac64de7989e4b7a9d to your computer and use it in GitHub Desktop.
Save bjzhush/78348ce7bf039c9ac64de7989e4b7a9d to your computer and use it in GitHub Desktop.
xdebug_start_trace
php.ini (php 5.6)
; add by zs
zend_extension=xdebug.so
xdebug.trace_output_dir = /tmp/traces
;代码跟踪日志文件格式
xdebug.trace_output_name = trace.%c.%p
;;trace中显示函数的参数值,这个很有用,待会细说
xdebug.collect_params = 4
xdebug.collect_includes = On
xdebug.collect_return = On
xdebug.show_mem_delta = On
// code here
<?php
xdebug_start_trace();
function say($a)
{
$a++;
echo $a;
return;
}
$a = 1;
say($a);
xdebug_stop_trace();
// trace log here
TRACE START [2016-05-22 09:34:50]
0.0002 239680 +88 -> say($a = 1) /home/wwwroot/default/x.php:11
0.0002 239728 >=> NULL
0.0002 239728 +48 -> xdebug_stop_trace() /home/wwwroot/default/x.php:12
0.0002 239784
TRACE END [2016-05-22 09:34:50]
(Time here is UTC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment