php用文件保存数据统计网页访问人数的函数_PHP教程
程序员文章站
2022-05-30 19:04:32
...
php用文件保存数据统计网页访问人数的函数
$jishu="jishu.txt";
if(!file_exists($jishu))
{
$kjs = fopen($jishu,"w");
fwrite($kjs,0);
fclose($kjs);
}
function kaishi($jishu)
{
$js = fopen($jishu,"r");
$du = fread($js,8);
fclose($js);
$du += 1;
echo "你是本站的第".$du."位访客!!!";
$xie = fopen($jishu,"w");
fwrite($xie,$du);
fclose($xie);
}
kaishi($jishu);