鍍金池/ 問答/PHP  測試  網(wǎng)絡(luò)安全/ php xdebug trace 調(diào)試的問題

php xdebug trace 調(diào)試的問題

學(xué)習(xí)xdebug的trace用法,現(xiàn)將遇到的問題寫在下面,希望高手指教,謝謝.

環(huán)境xdebug +sublime +chrome瀏覽器+debug helper

php.ini中的配置:

[xdebug]
zend_extension ="D:/wamp64/bin/php/php7.0.10/zend_ext/php_xdebug-2.4.1-7.0-vc14-x86_64.dll"
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.idekey=PHPSTORM

;遠(yuǎn)程調(diào)試
xdebug.remote_enable=ON
xdebug.remote_autostart=on

;開啟自動跟蹤
xdebug.auto_trace = On ;開啟自動跟蹤
xdebug.trace_output_dir="E:\xdebug\trace"
xdebug.trace_enable_trigger_value="XDEBUG_TRACE"
xdebug.collect_params = 4
xdebug.collect_includes = On
xdebug.collect_return = On
xdebug.show_mem_delta = On

;把執(zhí)行情況的分析文件寫入到指定目錄中
xdebug.profiler_enable=on
xdebug.profiler_output_dir="E:\xdebug\profiler"

被測試的php代碼switch.php:

function test($data,$func='strip_tags'){
xdebug_start_trace();
        if(empty($data)){
            return $data;
        }
        //需要對方法進(jìn)行約束
        switch($func){
            case 'strip_tags':
                $func="strip_tags";
                break;
            case 'intval':
                $func="intval";
                break;
            case 'htmlspecials':
                $func="htmlspecials";
                break;
            default:
                die;
        }
        return $func($data);
xdebug_stop_trace();

}

echo test("<sript>alert('abc');xxxx</script>");

xdebug helper設(shè)置:
圖片描述

訪問地址:http://localhost/NutCloud/demo/php_basic/test/switch.php?XDEBUG_TRACE

為啥我的E:xdebugtrace目錄下沒有任何文件產(chǎn)生,我哪個環(huán)節(jié)出了問題?

回答
編輯回答
醉淸風(fēng)

你把代碼自動跟蹤打開 xdebug.auto_trace=on 配置完要重啟PHP,看有輸出嗎

2017年9月8日 06:53
編輯回答
款爺

重啟過的,不是這塊的問題.我發(fā)現(xiàn)我的trace文件被存在d:盤下了,真是莫名奇妙.還有一個問題trace里面的時間和現(xiàn)在時間不一致,我在php文件頭部加了date_default_timezone_set('PRC');也不管用

2017年9月11日 17:33