Throwable::getPrevious
(PHP 7, PHP 8)
Throwable::getPrevious — 返回先前的 Throwable
参数
此函数没有参数。
+添加备注
用户贡献的备注 1 note
harry at upmind dot com ¶
6 years ago
/**
* Gets sequential array of all previously-chained errors
*
* @param Throwable $error
*
* @return Throwable[]
*/
function getChain(Throwable $error) : array
{
$chain = [];
do {
$chain[] = $error;
} while ($error = $error->getPrevious());
return $chain;
}
备份地址:http://www.lvesu.com/blog/php/throwable.getprevious.php