php的getter setter实现
php的getter setter实现 [代码片段(22行)]
<? class Person { protected $__data = array('person', 'email'); public function __get($property) { if (isset($this->__data[$property])) { return $this->__data[$property]; } else { return false; } } public function __set($property, $value) { if (isset($this->__data[$property])) { return $this->__data[$property] = $value; } else { return false; } } } ?>
精彩图集
精彩文章