« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 1 of about 1 for CustomException (0.001 sec.)
Throwable エラー | PHP 8.3 9414
Throwable エラー Throwable エラーとは、実行中に発生し、 通常の命令の流れを中断するイベントです。 Throwable エラーが throw されると、 catch ブロックでキャッチされるか、グローバルスコープに達するまで、 コールスタックが巻き戻されます。 巻き戻し ... ーバーライドすると、 オブジェクトが文字列として使われたときの出力を独自に定義できます。 例1 Exception を拡張する <?php class CustomException extends Exception { // コンストラクタを再定義し、メッセージを必須にする public function __construct ( $message , $code = 0 ... } \n" ; } public function customFunction () { echo "A custom function for this type of exception\n" ; } } try { throw new CustomException ( "Something happened" , 5 ); } catch ( CustomException $e ) { echo "Caught custom exception\n" , $e ; $e -> customFunctio ... n (); } 上の例の出力は以下となります。 Caught custom exception CustomException: [5]: Something happened A custom function for this type of exception Throwable の階層 Throwable Error Ar ...
https://man.mtool.work/php/8.3/language.error-handling.throwable.html
PREV 1 NEXT