What is the proper way to extend a class in another file?
问题 This is what I have in foo.php class Foo { public $foo = NULL; public $foo2 = NULL; public function setFoo ($foo, $foo2) { $this->foo = $foo; $this->foo2 = $foo2' } } This is what I have in foo3.php class Foo3 extends Foo { public $foo3 = NULL; public function setFoo3 ($foo3) { $this->foo = $foo3; } } This is how I require it in my third file run.php: require_once "foo.php"; require_once "foo3.php"; $foo = new Foo(); $foo->setFoo3("hello"); I get this error: Fatal error: Call to undefined