<?php class test{ //创建test类 public function __construct(){ self::getinfo(); //后期静态绑定 } public static function getinfo(){ echo '实例化一个test类的对象<br />'; } } class test1 extends test{ //创建继承自test类的test1类 public static function getinfo(){ echo '实例化一个test1类的对象<br />'; } } class test2 extends test1{ //创建继承自test1类的test2类 public static function getinfo(){ echo '实例化一个test2类的对象<br />'; } } //实例化三个类的对象 $test=new test(); $test1=new test1(); $test2=new test2(); echo "---------调用--------<br>"; $test->getinfo(); $test1->getinfo(); $test2->getinfo(); ?>