php get_class()函数
程序员文章站
2022-04-19 14:36:58
...
php class Car { function getName(){ echo "My name is " . get_class() . "
"; echo "My name is " . get_class($this) . "
"; } } //类内部调用 $bar = new Car(); $bar->getName(); //类外部调用 echo "Its name is " . get_class($bar) . "
"; ?>
运行结果
My name is Car
My name is Car
Its name is Car
以上就介绍了php get_class()函数,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。