執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <?php try { $rand = rand(0, 2); switch($rand) { case 0: throw new Exception(); case 1: throw new OutOfBoundsException(); case 2: throw new LogicException(); } } catch(OutOfBoundsException $e) { echo "Caught an out of bounds exception"; } catch(LogicException $e) { echo "Caught a logic exception"; } catch(Exception $e) { echo "Caught an ordinary exception"; } ?> </body> </html>
捕獲到越界異常