try throw catch 多个throw 捕获的问题

当有多个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;

?>

posted @ 2014-07-01 09:01  达也.  阅读(548)  评论(0)    收藏  举报