【发布时间】:2010-12-12 10:19:56
【问题描述】:
我有这门课:
class TestClass
{
var $testvar;
public function __construct()
{
$this->$testvar = "Hullo";
echo($this->$testvar);
}
}
还有这个访问方法:
function getCurrent()
{
$gen = new TestClass();
}
我收到以下错误:
注意:未定义变量:第 28 行 /Users/myuser/Sites/codebase/functions.php 中的 testvar
致命错误:无法访问第 28 行 /Users/myuser/Sites/codebase/functions.php 中的空属性
发生了什么事?
【问题讨论】: