运行结果My name is CarMy name is CarIts name is C">
当前位置:Gxlcms > PHP教程 > PHPget_class()函数

PHPget_class()函数

时间:2021-07-01 10:21:17 帮助过:4人阅读

<?php
class Foo {
    function name_none_static(){
    echo "My name is " . get_class() . "<br>";
        echo "My name is " . get_class($this) . "<br>";
    }
}
//类内部调用
$bar = new Foo();
$bar->name_none_static();
//类外部调用
echo "Its name is " . get_class($bar) . "<br>";
?>

输出结果:

My name is Foo
My name is Foo
Its name is Foo

人气教程排行