我认为这会奏效,但事实并非如此。
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