如何知道对象实例属于哪个类? (php5) [英] How to know what class is an object instance of? (php5)
本文介绍了如何知道对象实例属于哪个类? (php5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP 5中,如何确定对象实例属于哪个类?我知道我可以与"instanceof"运算符进行比较,但是当类名未知时,我似乎找不到如何进行操作.
In PHP 5, how do I figure out what class is an object instance of? I know I can compare with the "instanceof" operator, but I don't seem to find how to proceed when the Class name is unknown.
提前谢谢! :)
推荐答案
get_class(...)将告诉您对象是实例的类.
get_class(...) will tell you the class of which an object is an instance.
http://www.php.net/manual/en /function.get-class.php
这篇关于如何知道对象实例属于哪个类? (php5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文