Exception::getCode
(PHP 5 >= 5.1.0)
Exception::getCode — 例外コードを取得する
説明
final public int Exception::getCode
( void
)
例外コードを返します。
パラメータ
この関数にはパラメータはありません。
返り値
例外コードを表す整数値を返します。
例
例1 Exception::getCode() の例
<?php
try {
throw new Exception("Some error message", 30);
} catch(Exception $e) {
echo "The exception code is: " . $e->getCode();
}
?>
上の例の出力は、 たとえば以下のようになります。
The exception code is: 30
Exception::getCode
There are no user contributed notes for this page.
