Home >Backend Development >PHP Tutorial >Is there any function in php that can track the order of code loading, similar to the page_trace function in tp, [except debug_backtrace]

Is there any function in php that can track the order of code loading, similar to the page_trace function in tp, [except debug_backtrace]

WBOY
WBOYOriginal
2016-08-23 09:17:501230browse

Is there any function in php that can track the files loaded and the order in which the current script is executed? The function is similar to page_trace in thinkphp

Reply content:

Is there any function in php that can track the files loaded and the order in which the current script is executed? The function is similar to page_trace in thinkphp

<code class="php">$e = new \Exception;
var_dump($e->getTraceAsString());</code>
<code class="php">function A()
{
    echo 1;
    $e = new \Exception;
    var_dump($e->getTraceAsString());
}

function B()
{
    A();

}

function C()
{
    B();
}

C();</code>

It is very convenient to view the call stack, more readable than debug_backtrace

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn