php使用反射机制,获取类变化

可以使用反射类机制,如下

";
print_r(get_class_methods(new Test));echo "
"; print_r(get_class_vars(get_class(new Test)));echo "
"; //用反射类可以获得私有属性和私有方法 $ref = new ReflectionClass(new Test); print_r($ref->getMethods());echo "
"; print_r($ref->getProperties());

如下显示

php使用反射机制,获取类变化_第1张图片
Paste_Image.png

你可能感兴趣的:(php使用反射机制,获取类变化)