Website traffic statistics are inaccurate.
P粉313673935
P粉313673935 2023-11-12 21:49:13
0
0
640

<?php

$counterFile = './counter.txt';


##// Check if the counter file exists

if (file_exists($counterFile)) {

// Read the current counter value

$counter = file_get_contents($counterFile);

// Increase The value of the counter

$counter ;

} else {

// The initial counter is 1

$counter = 1;

}


//Write the new counter value to the file

file_put_contents($counterFile, $counter);


// Output the current number of visits

echo 'Website visits:' . $counter;

?>


After I added the above code to the homepage, the number increased every time the website was refreshed was not 1 but 3. For example, the first time it was 1, the next refresh would be 4, then 7, 10, 13, 16..., is there any master? Any idea where the problem is?

P粉313673935
P粉313673935

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template