当有多个throw语句时,catch捕获的是第一个throw语句
<?php $a=1;
try{ if($a!=2){ throw new Exception(‘not equal 2.‘);}
$a=b;
if($a!=3){ throw new Exception(‘not equal 3.‘);}
$a=c;
} catch (Exception $e){
echo $e->getMessage();
echo "<br>";
echo $a;
echo "<br>"; }
echo $a;
?>
try throw catch 多个throw 捕获的问题
时间: 2024-09-30 15:50:19