如何获得PHP完整调用跟踪,而不仅仅是堆栈调用跟踪?
以下是PHP的代码:如何获得PHP完整调用跟踪,而不仅仅是堆栈调用跟踪?,php,debug-backtrace,Php,Debug Backtrace,以下是PHP的代码: <?php function a() { b(); } function b() { c(); } function c(){ debug_print_backtrace(); } function d() { echo "I am a function d(). Where on the list is my call?\n"; } d(); a(); ?> 是否有方法获取完整的调用跟踪,而不仅仅是调用堆栈跟踪?
<?php
function a() {
b();
}
function b() {
c();
}
function c(){
debug_print_backtrace();
}
function d() {
echo "I am a function d(). Where on the list is my call?\n";
}
d();
a();
?>
是否有方法获取完整的调用跟踪,而不仅仅是调用堆栈跟踪?是的,有,但这只能通过在执行期间监视整个脚本来完成。这叫做剖析 XDebug是实现这一点的工具之一。有关更多详细信息,请参阅。请注意,XDebug将其分析数据写入目录,因此在执行过程中无法从PHP内部直接访问数据,这也会损坏分析数据,因为这些调用也会受到监视 还有一个XHProf,它允许在PHP中打开和关闭,并提供一个HTML GUI。这看起来相当容易
I am a function d(). Where on the list is my call?
#0 c() called at [D:\tests.php:18]
#1 b() called at [D:\tests.php:14]
#2 a() called at [D:\tests.php:31]