Throwable::getTrace
(PHP 7, PHP 8)
Throwable::getTrace — 获取堆栈踪迹(Stack Trace)
参数
此函数没有参数。
返回值
返回 array 的堆栈踪迹(Stack Trace),和 debug_backtrace() 具有相同的格式。
+添加备注
用户贡献的备注 1 note
rasmus at mindplay dot dk ¶
1 year 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.