在代码中启动xdebug?

rsk*_*k82 5 php debugging xdebug

我知道这些启动Xdebug的方法:

?XDEBUG_SESSION_START=name 在网址中

xdebug.remote_autostart=On 在php.ini中

-dxdebug.remote_autostart=On 作为PHP二进制调用的参数

但我不知道如何在代码中启动xdebug,是否有任何函数xdebug_start()xdebug_stop()

Lai*_*eed 7

xdebug_enable()
xdebug_disable()
Run Code Online (Sandbox Code Playgroud)

void xdebug_enable()启用堆栈跟踪

void xdebug_disable()禁用堆栈跟踪

http://xdebug.org/docs/all_functions

也从手动:xdebug_start_code_coverage,xdebug_get_code_coverage

<?php
    xdebug_start_code_coverage();

    function a($a) {
        echo $a * 2.5;
    }

    function b($count) {
        for ($i = 0; $i < $count; $i++) {
            a($i + 0.17);
        }
    }

    b(6);
    b(10);

    var_dump(xdebug_get_code_coverage());
?>  
Run Code Online (Sandbox Code Playgroud)


Der*_*ick 7

为了比在开始你的PHP代码别的地方启动调试,您需要设置xdebug.remote_mode=jitphp.ini.然后当你调用xdebug_break调试会话时会启动.