聘我网

新概念招聘3.0

如何使__set对静态调用也生效?

vote up0vote downstar

当我调用self::$parameter = 1;时,__set没被调用,

有没有办法解决?

 

1 个答复

vote up0vote downcheck

不行

引自手册

Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. As of PHP 5.3.0, a warning is issued if one of the magic overloading methods is declared static.

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.