Throwable

(PHP 7, PHP 8)

簡介

Throwable 是能被 throw 語句拋出的最基本的接口(interface),包含了 ErrorException

注意:

PHP 類無法直接實現(xiàn) (implement) Throwable 接口,而應(yīng)當去繼承 Exception。

接口摘要

interface Throwable extends Stringable {
/* 方法 */
public getMessage(): string
public getCode(): int
public getFile(): string
public getLine(): int
public getTrace(): array
public getTraceAsString(): string
abstract public __toString(): string
/* 繼承的方法 */
public Stringable::__toString(): string
}

更新日志

版本 說明
8.0.0 現(xiàn)在 Throwable 實現(xiàn)了 Stringable。

目錄