开发者

in php, how can I describe an object's properties and methods? [duplicate]

开发者 https://www.devze.com 2023-01-20 19:41 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: print_r to get object me开发者_如何学运维thods in PHP?
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

print_r to get object me开发者_如何学运维thods in PHP?

How can I show what all the objects' methods and properties are?

That is, including the property's values?


To discover what the properties and the methods of an object are you can use ReflectionClass.


See get_class_methods() and get_class_vars().

Also worth nothing that PHP's documentation is pretty good and generally a good place to ask first.

Edit: Of course, asking here seems to have its benefits as well. I never knew about the ReflectionClass Davide brought up :)

0

精彩评论

暂无评论...
验证码 换一张
取 消