__get()魔术方法,主要用于,在访问未定义的属性时被自动调用。其使用案例如下: <?phpclass Test { public function __get($name) { echo $name.'成员属性不存在!'; }}$obj = new Test();$obj->name;