Throwable
官方文檔地址: http://php.net/manual/en/class.throwable.php
PHP 支持版本: 7
Throwable 是 PHP 7 中可以用作任何對象拋出聲明的基本接口,包括 Expection (異常)和 Error (錯誤)。
Throwable { /* 抽象方法 */ abstract public string getMessage ( void ) // 獲取拋出的消息內容 abstract public int getCode ( void ) // 獲取拋出的錯誤代碼 abstract public string getFile ( void ) // 獲取產生異常的文件名 abstract public int getLine ( void ) // 獲取相關行號 abstract public array getTrace ( void ) // 獲取追蹤信息,返回數組形式 abstract public string getTraceAsString ( void ) // 獲取追蹤信息,返回字符串形式 abstract public Throwable getPrevious ( void ) // 返回上一個 Throwable abstract public string __toString ( void ) // 拋出的對象以字符串形式返回,可以用 echo 打印相應結果 }