只需一步,快速开始
?phpclassclass_name{var$attribute;function__get($name){return$this-$name;}function__set($name,$value){$this-$name$value;}}$an,php__get(),__set()函数来实现对属性的访问
class class_name { var $attribute; function __get($name) { return $this -> $name; } function __set($name,$value) { $this -> $name = $value; } } $a = new class_name(); $a -> attribute = 5;//__set()设置属性值 $a -> attribute; //__get()检查属性值 ?>
首页
分类
索引
我的