debug_print_backtrace
debug_print_backtrace
(PHP 5, PHP 7)
debug_print_backtrace - 打印回溯
描述
void debug_print_backtrace ([ int $options = 0 [, int $limit = 0 ]] )
debug_print_backtrace()
打印一个 PHP 回溯。它打印函数调用,包括/必需的文件和 eval()编辑的东西。
参数
options
从5.3.6开始,此参数是以下选项的位掩码:
DEBUG_BACKTRACE_IGNORE_ARGS | Whether or not to omit the "args" index, and thus all the function/method arguments, to save memory. |
---|
limit
从5.4.0
开始,此参数可用于限制打印的堆栈帧数。默认情况下(limit
= 0
)它会打印所有堆栈帧。
返回值
没有值返回。
更新日志
Version | Description |
---|---|
5.4.0 | Added the optional parameter limit. |
5.3.6 | Added the optional parameter options. |
例子
示例#1 debug_print_backtrace()示例
<?php
// include.php file
function a() {
b(
}
function b() {
c(
}
function c(){
debug_print_backtrace(
}
a(
?>
<?php
// test.php file
// this is the file you should run
include 'include.php';
?>
上面的例子会输出类似于:
#0 c() called at [/tmp/include.php:10]
#1 b() called at [/tmp/include.php:6]
#2 a() called at [/tmp/include.php:17]
#3 include(/tmp/include.php) called at [/tmp/test.php:3]
- debug_backtrace() - 生成回溯
← debug_backtrace
error_clear_last →