PHP+TXT简单计数器

<?php
$filepath=”txt.txt”;
$file = fopen($filepath,”r”);
$idsum=fgets($file);
fclose($file);
$file2 = fopen($filepath,”w”);
$idsum1=(integer)$idsum+1;
echo “您是第”;
echo $idsum1;
echo “位访客”;
fwrite($file2,$idsum1);
fclose($file2);
?>