get_class() : 范湖对象的类名
string get_class ([ object $obj ] )
返回对象实例 obj 所属类的名字。如果 obj 不是一个对象则返回 FALSE。
Example #1 使用 get_class()
<?php
class foo {
function foo()
{
// implements some logic
}
function name()
{
echo "My name is " , get_class($this) , " ";
}
}
// create an object
$bar = new foo();
// external call
echo "Its name is " , get_class($bar) , " ";
// internal call
$bar->name();
?>
以上例程会输出:
Its name is foo My name is foo