有更好的方法吗?fopen,fread,fwrite


is there a better way to do this? fopen, fread, fwrite

有更好的方法吗:

$countfile = fopen("count.txt", 'r');
$read = fread($ebf, filesize("count.txt")); 
$ebn = $read+1;
fclose($ebf);
$ebf = fopen($ebc, 'w');
fwrite($ebf, $ebn);

我写了这个脚本来计算访问量

您可以通过file_get_contents和file_put_contents:获得相同的结果

$read = file_get_contents("count.txt");
$ebn = $read+1;
file_put_contents($ebc, $ebn);