Throwable work on PHP 7.x.
Exception work on PHP 5.x.
参考链接: https://www.php.net/manual/en/language.errors.php7.php
<?php
try {
// Code that may throw an Exception or Error.
} catch (Throwable $t) {
// Executed only in PHP 7, will not match in PHP 5
} catch (Exception $e) {
// Executed only in PHP 5, will not be reached in PHP 7
}
本文讨论了PHP7.x中引入的新Throwable类与PHP5.x中的Exception类在异常处理上的区别,指出在不同版本中catch块的执行条件。
394

被折叠的 条评论
为什么被折叠?



