<?php try { dsss(); } catch (Exception $e) { echo $e->getMessage(); // die(); // 终止异常 } function dsss() { try { $num1 = 3; $num2 = 0; if ($num2 == 0) { throw new Exception("11321"); } else { $res = $num1 / $num2; } } catch (Exception $e) { throw $e; } } ?>