(PHP 5, PHP 7, PHP 8)
Exception::getMessage — 取得例外訊息
回傳例外訊息。
此函式沒有參數。
以字串形式回傳例外訊息。
範例 #1 Exception::getMessage() 範例
<?phptry { throw new Exception("一些錯誤訊息");} catch(Exception $e) { echo $e->getMessage();}?>
上述範例將輸出類似以下的內容
Some error message