'; } } //直接调用类常量 echo classA::a.''; //对象::类常量 $obj = new ClassA(); echo $obj::a.''; echo $obj->a.''; //对象不能访问类常量,会报“Undefined property: classA::$a” //对象中方法调用类常量 echo $obj->func(); ?>