温馨提示×

php get_class()函数的用法是什么

PHP
小樊
85
2024-08-14 14:43:35
栏目: 编程语言

get_class()函数用于获取一个对象的类名。其语法为:

string get_class ( object $object )

其中,$object是要获取类名的对象。调用该函数时,会返回对象的类名字符串。

例如,假设有一个名为Person的类:

class Person {
    public $name;
}

$person = new Person();
echo get_class($person); // 输出:Person

0