ReflectionClass::getConstants

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getConstants获取常量

说明

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

从类中获取所有已定义的常量,而不管它们的可见性如何。

参数

filter

可选过滤器,传入过滤所需的可见性常量。可用 ReflectionClassConstant 常量 进行配置,默认为所有可见性常量。

返回值

常量的数组,常量名是数组的键,常量的值是数组的值。

更新日志

版本 说明
8.0.0 添加 filter

参见

7i24.Com