ReflectionClass::getMethods 获取方法的数组 &reftitle.description; public arrayReflectionClass::getMethods intnullfilter&null; 获取类的方法的数组。 &reftitle.parameters; filter 过滤结果为仅包含某些属性的方法。默认不过滤。 ReflectionMethod::IS_STATICReflectionMethod::IS_PUBLICReflectionMethod::IS_PROTECTEDReflectionMethod::IS_PRIVATEReflectionMethod::IS_ABSTRACTReflectionMethod::IS_FINAL 的按位或(OR),就会返回任意满足条件的属性。 请注意:其他位操作,例如 ~ 无法按预期运行。这个示例也就是说,无法获取所有的非静态方法。 &reftitle.returnvalues; 包含每个方法 ReflectionMethod 对象的数组 &reftitle.changelog; &Version; &Description; 7.2.0 filter 现在允许为 null。 &reftitle.examples; <methodname>ReflectionClass::getMethods</methodname> 的基本用法 getMethods(); var_dump($methods); ?> ]]> &example.outputs; object(ReflectionMethod)#2 (2) { ["name"]=> string(11) "firstMethod" ["class"]=> string(5) "Apple" } [1]=> object(ReflectionMethod)#3 (2) { ["name"]=> string(12) "secondMethod" ["class"]=> string(5) "Apple" } [2]=> object(ReflectionMethod)#4 (2) { ["name"]=> string(11) "thirdMethod" ["class"]=> string(5) "Apple" } } ]]> 从 <methodname>ReflectionClass::getMethods</methodname> 中过滤结果 getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_FINAL); var_dump($methods); ?> ]]> &example.outputs; object(ReflectionMethod)#2 (2) { ["name"]=> string(12) "secondMethod" ["class"]=> string(5) "Apple" } [1]=> object(ReflectionMethod)#3 (2) { ["name"]=> string(11) "thirdMethod" ["class"]=> string(5) "Apple" } } ]]> &reftitle.seealso; ReflectionClass::getMethod get_class_methods