php父类中获取当前正在运行的子类的类名,代码如下:
<?php class person { public static function show() { print_r(get_class());echo "\n"; print_r(get_called_class());echo "\n"; print_r(self::class);echo "\n"; print_r(__CLASS__);echo "\n"; print_r(static::class); } } class zhangsan extends person { } zhangsan::show();
结果输出如下:
person zhangsan person person zhangsan