我有两个简单的类
Parent
class Parent {
public function __call($name, $args)
{
return call_user_func_array([$this, $name], $args);
}
}
和Child
class Child extends Parent {
private function test()
{
return 1;
}
}
当我执行Child
对象$child->test()
时,我的Symfony服务器(由php bin/console server:run
运行)发生故障。只有消息为[ERROR] Built-in server terminated unexpectedly.
。
答案 0 :(得分:2)
方法Parent
是私有的,无法从protected
范围执行。制作方法{{1}}。