PHP8 PDOException 異常類(lèi)

2024-03-26 09:50 更新

(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 {
/* 屬性 */
protected int|string $code;
public ?array $errorInfo = null;
/* 繼承的屬性 */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* 繼承的方法 */
public Exception::__construct(string $message = "", int $code = 0, ?Throwable $previous = null)
final public Exception::getMessage(): string
final public Exception::getPrevious(): ?Throwable
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()

code

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


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)