PHP中的魔术方法
PHP中有下列称之为魔术方法(magic method)的函数:__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toString, __set_state, __clone and __autoload,本文使用__call为实现一个身份验证的简单实例,代码如下: 代码 复制代码 <?php interface Accountable { const ERR_MSG = "error"; public function isLoggedIn(); public function getAccount($user = ''); } abstract class Authentication implements Accountable { private $account = null; public function getAccount($user = '') ...