class Math {
const num=3.14;
public function showNum(){
return self::num;
}
}
echo Math::num."<br/>";
$math=new Math();
echo $math->showNum();
结果:
3.14
3.14
标签:io strong sp div c on cti r new
PHP类常量的常见访问方法
class Math {
const num=3.14;
public function showNum(){
return self::num;
}
}
echo Math::num."<br/>";
$math=new Math();
echo $math->showNum();
结果:
3.14
3.14
标签:io strong sp div c on cti r new
原文地址:http://www.cnblogs.com/sheevy/p/4010661.html