本文介绍了php点击计数器在刷新时增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好!我需要打个柜台.
我在counter.php文件中使用了以下代码:
Hello!I need to make a hit counter.
I used this code in the counter.php file:
<?PHP
session_start();
if(isset($_SESSION['views'])){
$_SESSION['views'] = $_SESSION['views']+ 1;
}else{
$_SESSION['views'] = 1;
}
echo "Total page views = ". $_SESSION['views'];
?>
并在我将使用命中计数器的文件中使用了此代码:
and used this code in the file where i will be using my hit counter:
<?php
echo "<hr><div align=\"center\">";
include_once "counter.php"; // this will include the counter.
echo "</div>";
?>
但我不希望计数器在刷新页面时增加.这不是我的代码.我从某个网站复制了它.我们将不胜感激.
but I don''t want the counter to increase on refreshing the page. This is not my code.I copied it from some site. Any help would be appreciated.
推荐答案
这篇关于php点击计数器在刷新时增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!