深入理解面向对象6
2018年8月21日调用不存在的方法,使用魔术方法 __call() __callStatic() 的魔术方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php class Account { private $user = 1; private $pwd = 2; public function __call($name, $arguments) { echo '参数不对'; } public static function __callStatic($name, $arguments) { echo '参数不对'; } } $a = new Account(); $a->hehe(); $a::hehe(); |