$this->name和$this->$name的区别,我糊涂了! $name=aaa;$this->$name 等於 $this->aaa;$this->aaa是類變量 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class a{ private $name; $this->name; private $$name; $this->$name;} <?php class classname{ private $attribute; function __get($name) { echo "__get"."<br />"; return $this->$name."<br/>"; } function __set($name,$value) { echo "__set"."<br />"; $this->$name=$value; } } $a = new classname; $a->attribute = 90; echo $a->attribute; ?>此时输出:__set__get90但是把类外语句改为:$a->$attribute = 90; echo $a->$attribute;(或echo $a->attribute;)就只输出:__set__get何解呢? PHP读取TXT问题2 什么叫指定解析器 PHP做的系统,下载文件时遇到的问题 请教:mysql如何只赋于用户insert权限,不允许更新,不允许删除 急:smarty 上传到空间 配置文件需要怎样配置? 这条语句哪出错了 如何在php程序中调用google或百度的API把结果显示在自己的网页中 session与url的问题, 这种新闻功能是怎样实现的? js wap 内容已被编辑! 真心求一本项目开发实例的书
class a
{
private $name;
$this->name; private $$name;
$this->$name;
}
class classname{
private $attribute;
function __get($name)
{
echo "__get"."<br />";
return $this->$name."<br/>";
}
function __set($name,$value)
{
echo "__set"."<br />";
$this->$name=$value;
}
} $a = new classname;
$a->attribute = 90;
echo $a->attribute;
?>此时输出:
__set
__get
90
但是把类外语句改为:
$a->$attribute = 90;
echo $a->$attribute;(或echo $a->attribute;)
就只输出:
__set
__get何解呢?