主页
PHP
PHP Exception getPrevious() 方法
tryphp_exception_getprevious
运行 ❯
×
更改方向
保存代码
更改主题
<?php try { try { throw new Exception("An error occurred", 1); } catch(Exception $e1) { throw new Exception("Another error occurred", 2, $e1); } } catch (Exception $e2) { echo $previous = $e2->getPrevious(); echo $previous->getMessage(); } ?>