• <rp id="gzxyh"><listing id="gzxyh"></listing></rp>
    <kbd id="gzxyh"></kbd>

    <b id="gzxyh"><legend id="gzxyh"><b id="gzxyh"></b></legend></b>
    <source id="gzxyh"></source>
    <u id="gzxyh"></u>
    1. PHP8 Throwable

      2023-08-21 15:08 更新

      (PHP 7, PHP 8)

      簡介

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

      注意:PHP 類無法直接實現 (implement) Throwable 接口,而應當去繼承 Exception。

      接口摘要

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

      更新日志

      版本 說明
      8.0.0 現在 Throwable 實現了 Stringable。

      目錄

      • Throwable::getMessage — 獲取信息
      • Throwable::getCode — 獲取異常代碼
      • Throwable::getFile — 獲取創建對象的文件
      • Throwable::getLine — 獲取初始化對象時候的行號
      • Throwable::getTrace — 獲取堆棧蹤跡(Stack Trace)
      • Throwable::getTraceAsString — 以 string 形式獲取堆棧蹤跡
      • Throwable::getPrevious — 返回先前的 Throwable
      • Throwable::__toString — 獲取 Throwable 對象 string 形式的表達


      以上內容是否對您有幫助:
      在線筆記
      App下載
      App下載

      掃描二維碼

      下載編程獅App

      公眾號
      微信公眾號

      編程獅公眾號