Throwable::getCode()获取异常代码(PHP 7, PHP 8) Throwable::getCode — 获取异常代码 说明 public Throwable::getCode(): int 返回 thrown 对象关联的的错误号。 参数 此函数没有参数。 返回值 返回 Exception 的 int 异常代码,但如果是 Exception 的子类,可能会使其他类型(例如,PDOException 返回的类型是 string )。