欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php get_class()函数,phpget_class函数_PHP教程

程序员文章站 2022-05-11 16:13:22
...

php get_class()函数,phpget_class函数

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/965026.htmlTechArticlephp get_class()函数,phpget_class函数 ? php class Car { function getName(){ echo "My name is " . get_class () . "br" ; echo "My name is " . get_class ( $this ) . "br" ; } } //...
相关标签: php