我认为这会起作用,但事实并非如此。
class Foo {
public function send($to, $message)
{
echo 'sending';
}
public static function __callStatic($method, $params)
{
return call_user_func_array(array(new static, $method), $params);
}
}
当我这样做时Foo::send('mary','you had a little lamb')
,为什么它仍在调用Foo::send()
而不是new Foo ->send($to, $message)
?
Non-static method Foo::send() should not be called statically, assuming $this from incompatible context