PHP function that uses files to save data to count the number of visitors to a web page
$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 "You are the ".$du." visitor to this site!!!";
$xie = fopen($jishu,"w");
fwrite($xie,$du);
fclose($xie);
}
kaishi($jishu);