Throwable::getCode

(PHP 7, PHP 8)

Throwable::getCode獲取異常代碼

說明

public Throwable::getCode(): int

返回 thrown 對(duì)象關(guān)聯(lián)的的錯(cuò)誤號(hào)。

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

返回 Exceptionint 異常代碼, 但如果是 Exception 的子類,可能會(huì)使其他類型(例如,PDOException 返回的類型是 string )。

參見