我尝试打印创建新对象的类的名称。我得到了这个代码:
class Class_A
{
public function __construct()
{
echo "new ".__class__." : are created"."<br />";
}
}
class B extends Class_A
{
}
class C extends Class_A
{
}
$NewObject1= new B ( );
$NewObject2= new C ( );
输出是:
new Class_A : are created
new Class_A : are created
为什么不new B : are created
new C : are created
呢?
我也尝试过,getParentClass()
但它不起作用谢谢!