<分区>
目前我正在阅读 PHP 5 OOP ( properties section ),在那里我发现了以下语句:
Within class methods the properties, constants, and methods may be accessed by using the form $this->property
这很奇怪,但我无法使用该格式访问常量。以下代码将引发通知:
class A
{
const HELLO = 'HELLO WORLD';
public function __construct()
{
echo $this->HELLO;
}
}
$a = new A();
我是不是误解了什么或者文档的作者犯了错误?