CakeFest 2024: The Official CakePHP Conference

Error::getCode

(PHP 7, PHP 8)

Error::getCodeエラーコードを取得する

説明

final public Error::getCode(): int

エラーコードを返します

パラメータ

この関数にはパラメータはありません。

戻り値

エラーコードを int 型として返します

例1 Error::getCode() の例

<?php
try {
throw new
Error("Some error message", 30);
} catch(
Error $e) {
echo
"The Error code is: " . $e->getCode();
}
?>

上の例の出力は、 たとえば以下のようになります。

The Error code is: 30

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top