PHP |反射 getName()函数
Reflection::getName()函数是PHP中的一个内置函数,用于返回指定类的名称。
句法:
string Reflection::getName( void )
参数:此函数不接受任何参数。
返回值:该函数返回指定类的名称。
下面的程序说明了PHP中的 Reflection::getName()函数:
方案一:
getName();
// Getting the name of the specified class
var_dump($A);
?>
输出:
string(11) "Departments"
方案二:
getName();
// Getting the name of the class
var_dump($A);
?>
输出:
string(15) "ReflectionClass"
参考: https://www. PHP.net/manual/en/reflectionclass.getname。 PHP