Home >php教程 >PHP源码 >静态网页 浏览量更新及显示

静态网页 浏览量更新及显示

PHP中文网
PHP中文网Original
2016-05-25 17:09:311579browse

代码

<?php
//db更新(update数据库或文件)
//db取出(select 浏览量)
$viewnum = "123456" //比如取出浏览量为123456
//补0(页面显示效果)
$viewnum = str_pad($viewnum,11,"0",STR_PAD_LEFT);
for($i=0;$i<=9;$i++)
{
        //把数字替换html标签 方便css操作
	$viewnum=str_replace($i,"<i class=&#39;n$i&#39;></i>",$viewnum);
}
?>
<?php header("Content-type: text/javascript");?>
document.write("<?php echo $viewnum;?>");   //输出

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn