__get,__set 为php的magic方法,在类中定义为 public 类型. class UserModel { private $id; public $name; public function __get($property_name) { if(isset($this->$property_name)) { return($this->$property_name); }else { return(NULL); } } public function __set($proper…