(PHP 7, PHP 8)
Error::getCode — 取得錯誤碼
回傳錯誤碼。
此函式沒有參數。
以 int 型態回傳錯誤碼
範例 #1 Error::getCode() 範例
<?phptry { throw new Error("一些錯誤訊息", 30);} catch(Error $e) { echo "錯誤碼為: " . $e->getCode();}?>
上述範例將輸出類似以下的內容
The Error code is: 30