首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

php种常量定制及使用方法

2012-12-22 
php类常量定制及使用方法?实例代码如下:?php/* ?* To change this template, choose Tools | Templates?*

php类常量定制及使用方法

?

实例代码如下:

<?php
/*
?* To change this template, choose Tools | Templates
?* and open the template in the editor.
*/

/**
?* Description of classConstSample
?*
?* @author liujl
?*/
class classConstSample {
??? const constVarTest="<a href='http://www.my400800.cn' title='400电话'>http://www.my400800.cn</a><br>";


??? static public function? showMsgTest() {
??????? echo "利用内部方法输出常量值:".self::constVarTest;
??? }

}

//常量调用输出测试
classConstSample::showMsgTest();
echo "直接输出常量值:".classConstSample::constVarTest;

?>

?

?

输出结果如下:

?

?

利用内部方法输出常量值:http://www.my400800.cn
直接输出常量值:http://www.my400800.cn

?

输出结果截图如下:


php种常量定制及使用方法

热点排行