PHP 中的 debug_print_backtrace() 函数
phpprogrammingserver side programming更新于 2025/11/22 10:58:00
PHP 中的 debug_print_backtrace() 函数显示回溯。它不返回值。
语法
debug_print_backtrace(options, limit)
参数
options − 以下给定选项的位掩码
- DEBUG_BACKTRACE_IGNORE_ARGS:是否省略 "args" 索引和所有函数/方法参数,以节省内存。
limit −限制打印的堆栈帧数。
返回
debug_print_backtrace() 函数不返回值。
示例
下面是一个例子 −
<?php
function Test1() {
Test2();
}
function Test2() {
Test3();
}
function Test3() {
Test4();
}
function Test4() {
debug_print_backtrace();
}
Test1();
?>
输出
Hi: helloarray(1) {
[0]=>
array(4) {
["file"]=>
string(30) "/home/cg/root/4127336/main.php"
["line"]=>
int(7)
["function"]=>
string(7) "display"
["args"]=>
array(1) {
[0]=>
string(5)
"hello"
}
}
}

