ReflectionClass::getConstants

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getConstants獲取常量

說明

public ReflectionClass::getConstants(?int $filter = null): array

從類中獲取所有已定義的常量,而不管它們的可見性如何。

參數(shù)

filter

可選過濾器,傳入過濾所需的可見性常量??捎? ReflectionClassConstant 常量 進(jìn)行配置,默認(rèn)為所有可見性常量。

返回值

常量的數(shù)組,常量名是數(shù)組的鍵,常量的值是數(shù)組的值。

更新日志

版本 說明
8.0.0 添加 filter

參見