PDOException 異常類(lèi)

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

簡(jiǎn)介

代表一個(gè)由 PDO 產(chǎn)生的錯(cuò)誤。在自己的代碼不應(yīng)拋出一個(gè) PDOException 異常。關(guān)于 PHP 異常的更多信息請(qǐng)參見(jiàn) 異常

類(lèi)摘要

class PDOException extends RuntimeException {
/* 屬性 */
public array $errorInfo;
protected string $message;
protected string $code;
/* 繼承的方法 */
final public Exception::getMessage(): string
final public Exception::getCode(): int
final public Exception::getFile(): string
final public Exception::getLine(): int
final public Exception::getTrace(): array
final public Exception::getTraceAsString(): string
public Exception::__toString(): string
private Exception::__clone(): void
}

屬性

errorInfo

相當(dāng)于PDO::errorInfo()PDOStatement::errorInfo()

message

文本錯(cuò)誤信息。用 Exception::getMessage() 來(lái)訪問(wèn)。

code

SQLSTATE 錯(cuò)誤碼。用Exception::getCode() 來(lái)訪問(wèn)。