示例类:
class Example{ public static $ONE = [1,'one']; public static $TWO = [2,'two']; public static $THREE = [3,'three']; public static function test(){ // manually created array $arr = [ self::$ONE,self::$TWO,self::$THREE ]; } }
就在这里:
原文链接:https://www.f2er.com/php/137621.html使用Reflection和getStaticProperties()方法
class Example{ public static $ONE = [1,'three']; public static function test(){ $reflection = new ReflectionClass(get_class()); return $reflection->getStaticProperties(); } } var_dump(Example::test());