PHP统计网站访问次数防刷新

2016-4-15 二赛君 学习笔记

<?  
@session_start();  
$counter = intval(file_get_contents("counter.dat"));  
if(!$_SESSION['jingyun'])  
{  
 $_SESSION['jingyun'] = true;  
 $counter++;  
 $fp = fopen("counter.dat","w");  
 fwrite($fp, $counter);  
 fclose($fp);  
}  
?>  
  
总访问 <span style="font-size:14px; color:#FF6600" mce_style="font-size:14px; color:#FF6600"><?php echo "$counter";?></span> 次
转载自CSDN

标签: PHP 统计代码

发表评论:

Copyright 2011-2017 | Powered by emlog | Redesigned by Kaspar.s
京ICP备13003113号 sitemap