Simple counter
/*
|| A simple counter
*/
function Get_hitcount ($counter _file)
{
/* Reset counter to zero
So if the counter is not yet in use, the initial value will be 1.
Of course you can set the initial value to 20000来.
*/
$count = 0;
If the store counter file already exists, read the contents
if (file_exists ($counter _file))
{
$FP =fopen ($counter _file, "R");
We only took the top 20, I hope your site is not too popular AH
$count =intval (fgets ($FP, 20));
Since the function fgets () returns a string, we can automatically convert it to an integer by adding a 0 method
Fclose ($FP);
Operation completed on file
}
Increase the value of a single count
$count;
Writes a new count value to a file
$FP =fopen ($counter _file, "w");
Fputs ($fp, $count);
Fclose ($FP);
# returns the Count value
return ($count);
}
?>
http://www.bkjia.com/PHPjc/631904.html www.bkjia.com true http://www.bkjia.com/PHPjc/631904.html techarticle simple counter?/* | | A simple counter */function Get_hitcount ($counter _file) {/* The counter is zeroed so if the counter has not been used, the initial value will be 1 of course you can ...