PHP 8.4.0 RC2 available for testing

Throwable::getTrace

(PHP 7, PHP 8)

Throwable::getTrace获取堆栈踪迹(Stack Trace)

说明

public Throwable::getTrace(): array

返回 array 的堆栈踪迹(Stack Trace)。

参数

此函数没有参数。

返回值

返回 array 的堆栈踪迹(Stack Trace),和 debug_backtrace() 具有相同的格式。

参见

add a note

User Contributed Notes 1 note

up
2
rasmus at mindplay dot dk
10 months ago
Note that, where `debug_backtrace()` accepts an argument, which lets you configure options for the backtrace, `getTrace()` has no such argument.

Whether the `getTrace` method captures arguments instead depends on the `zend.exception_ignore_args` INI setting, which must be set to `0` ahead of time, before an exception occurs. (notice the confusing double negation here - to *enable* capture of arguments, you must *disable* this INI flag.)

Unlike `debug_backtrace()`, the `getTrace` method does not appear to capture the `object` value.
To Top