生成 PHP 回溯:
<?php
function a($txt) {
b("Glenn");
}
function b($txt) {
c("Cleveland");
}
function c($txt) {
var_dump(debug_backtrace());
}
a("Peter");
?>
亲自试一试 »
debug_backtrace() 函数生成 PHP 回溯。
此函数显示导致 debug_backtrace() 函数的代码中的数据。
返回关联数组的数组。可能返回的元素有:
Name | Type | Description |
---|---|---|
function | string | The current function name |
line | integer | The current line number |
file | string | The current file name |
class | string | The current class name |
object | object | The current object |
type | string | The current call type. Possible calls:
|
args | array | If inside a function, it lists the functions arguments. If inside an included file, it lists the included file names |
debug_backtrace(
options,
limit);
Parameter | Description |
---|---|
options | Optional. Specifies a bitmask for the following options: DEBUG_BACKTRACE_PROVIDE_OBJECT (Whether or not to populate the "object" index DEBUG_BACKTRACE_IGNORE_ARGS (Whether or not to omit the "args" index, and all the function/method arguments, to save memory) |
limit | Optional. Limits the number of stack frames printed. By default (limit=0) it prints all stack frames |
返回值: | 关联数组的数组 |
---|---|
PHP 版本: | 4.3+ |
PHP 变更日志: | PHP 5.4:可选参数限制加入 PHP 5.3.6:参数提供对象被改为选项并添加了附加选项 DEBUG_BACKTRACE_IGNORE_ARGS PHP 5.2.5:可选参数提供对象加入 PHP 5.1.1:添加当前对象作为可能的返回元素 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!