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()检查属性值
http://www.bkjia.com/PHPjc/632477.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632477.htmlTechArticleclass class_name { var $attribute; function __get($name) { return $this - $name; } function __set($name,$value) { $this - $name = $value; } } $a = new class_name(); $a - attribute...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn