Exception
PHP 手册

Exception::getMessage

(PHP 5 >= 5.1.0)

Exception::getMessageGets the Exception message

说明

final public string Exception::getMessage ( void )

Returns the Exception message.

参数

This function has no parameters.

返回值

Returns the Exception message as a string.

范例

Example #1 Exception::getMessage() example

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

上例的输出类似于:

Some error message


Exception
PHP 手册