php xdebug工具的使用语法

来源:互联网 发布:js设置innerhtml 编辑:程序博客网 时间:2024/06/05 08:04


1. xdebug 分析php代码:

trace代码:在php配置

xdebug.trace_format = 0xdebug.auto_trace = Offxdebug.trace_output_dir = /www/web/develop/erp/var/xdebugxdebug.trace_output_name = trace.%c.%p


将auto_trace关闭,然后在php代码中进行跟踪

xdebug_start_trace();    do something....xdebug_stop_trace();


生成的trace文件将保存到 /www/web/develop/erp/var/xdebug中


2.代码时间跟踪:  xdebug_time_index()

<?php  echo xdebug_time_index(), "\n";  for ($i = 0; $i < 250000; $i++)  {      // do nothing  }  echo xdebug_time_index(), "\n";  ?> 

3头消息

xdebug_get_headers() 

    <?php      header( "X-Test", "Testing" );      setcookie( "TestCookie", "test-value" );      var_dump( xdebug_get_headers() );      ?>  

4 xdebug_call_class()  获取文件名,行号,函数名

<?php    function fix_string($a)    {        echo "Called @ ".            xdebug_call_file().            ":".            xdebug_call_line().            " from ".            xdebug_call_function();    }    $ret = fix_string(array('Derick'));?>输出:Called @ /var/www/xdebug_caller.php:12 from {main}





0 0
原创粉丝点击