假设我们有如下代码:
<?php
class Worker {
public function __invoke() {
echo "invoked\n";
}
}
class Caller {
public $worker;
public function __construct($worker) {
$this->worker = $worker;
}
public function __call($name, $arguments) {
echo "called\n";
}
}
$c = new Caller(new Worker());
echo $c->worker();
?>
结果是called
。做什么才能得到invoked
?