Home >Backend Development >PHP Tutorial >PHP tutorial. Application example 3_PHP tutorial
PHP counter
$counterFile = "balong.txt";//The file name and path to store the value
function displayCounter($counterFile) {
$fp = fopen($counterFile, "rw");
$num = fgets($fp,5);
$num += 1;
print "You are the "."$num"." to view the Balong counter guy";
exec( "rm -rf $counterFile");
exec( "echo $num > $counterFile");
}
if (!file_exists($counterFile)) {
exec( "echo 0 > $counterFile");
}
displayCounter($counterFile);
?>