编程语言
首页 > 编程语言> > 如何使__set也适用于PHP中的静态操作?

如何使__set也适用于PHP中的静态操作?

作者:互联网

当我调用self :: $parameter = 1; __set未被调用.

有办法解决吗?

解决方法:

manual

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.

所以,我不敢.

标签:php,static,magic-methods
来源: https://codeday.me/bug/20190726/1546629.html