Home >Backend Development >PHP Tutorial >PHP web page number counter code_PHP tutorial
php web page number counter code This php counter is a simple counter code used to count the number of visits to a web page. It uses txt text files and the php fopen function to operate.
php tutorial web page number counter code
This php counter is a simple counter code used to count the number of visits to a web page. It uses txt text files and the php fopen function to operate.
*/
$log = 'log/count.txt';
$count_img = 'img/counter';$fp = @fopen($log, "r+") or die($log.'The data file cannot be opened!');
$count = fgets($fp, 64);
flock($fp, 2);
$count = (int)$count + 1;
rewind($fp);
fputs($fp, $count);
fclose($fp);
if($conf_showcount == '1'){
for ($i=0; $i$num = substr($count, $i, 1);
echo '';
}
}