Error::getTraceAsString
(PHP 7, PHP 8)
Error::getTraceAsString — 获取字符串形式的调用栈(stack trace)
说明
final public Error::getTraceAsString(): string
以字符串形式返回 stack trace。
参数
此函数没有参数。
返回值
以字符串形式返回 stack trace。
范例
示例 #1 Error::getTraceAsString() 例子
<?php
function test() {
throw new Error;
}
try {
test();
} catch(Error $e) {
echo $e->getTraceAsString();
}
?>
以上例程的输出类似于:
#0 /home/bjori/tmp/ex.php(7): test() #1 {main}

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/error.gettraceasstring.php