1
我想知道为什么以下行会导致错误。 doSomething()
从另一个PHP文件中调用。访问PHP中的类变量
class MyClass
{
private $word;
public function __construct()
{
$this->word='snuffy';
}
public function doSomething($email)
{
echo('word:');
echo($this->word); //ERROR: Using $this when not in object context
}
}