class Bob extends Person
{
//do some stuff
}
class Person
{
public function __construct()
{
//get the class name of the class that is extending this one
//should be Bob
}
}
Run Code Online (Sandbox Code Playgroud)
如何Bob从类的构造函数中获取类名Person?