php子类调用父类成员
php子类调用父类成员
方法1:通过实例化父类调用父类的成员
方法2:通过$this关键字调用父类成员
class Person{ public function show() { echo '这是人类'; } } //子类 继承 父类 class Student extends Person{ //方法1 $person = new Person; $Person->show(); //方法2 $this->show(); } $stu = new Student; $stu->show();