首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

debug_print_backtrace

(PHP 5, PHP 7)

debug_print_backtrace - 打印回溯

描述

代码语言:javascript
复制
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()示例

代码语言:javascript
复制
<?php
//?include.php?file

function?a()?{
????b();
}

function?b()?{
????c();
}

function?c(){
????debug_print_backtrace();
}

a();

?>
代码语言:javascript
复制
<?php
//?test.php?file
//?this?is?the?file?you?should?run

include?'include.php';
?>

上面的例子会输出类似于:

代码语言:javascript
复制
#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 →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com