PHP 8.3.4 Released!

Exception::getMessage

(PHP 5, PHP 7, PHP 8)

Exception::getMessage例外メッセージを取得する

説明

final public Exception::getMessage(): string

例外メッセージを返します。

パラメータ

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

戻り値

例外メッセージ文字列を返します。

例1 Exception::getMessage() の例

<?php
try {
throw new
Exception("Some error message");
} catch(
Exception $e) {
echo
$e->getMessage();
}
?>

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

Some error message

参考

add a note

User Contributed Notes

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