第19章 类与物件(PHP5) 之十:魔法方法(Magic Methods)函式名__construct, __destruct (注意构造函式和析构函式), __call,
基于56个网页-相关网页
首先,在刚开始编写魔法方法时,类的复杂性显著增加。
First, the complexity of classes increases tremendously when you start writing magic methods.
如果没有,那么就调用类上的魔法方法__ call(如果这个方法存在的话)。
Otherwise, the magic method __call is invoked on the class if that method is present.
我非常喜欢PHP的设计者这么有想法,把这些魔法方法包含在语言中,这样我们才能编写这类代码。
I love that the designers of PHP have been thoughtful enough to include these magic methods in the language so that we can write precisely this type of code.
应用推荐