[英]__callStatic is not calling my non-static function
我認為這會奏效,但事實並非如此。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.