Home >Backend Development >PHP Tutorial >PHP tutorial. Application example 3_PHP tutorial

PHP tutorial. Application example 3_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:22:35799browse

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);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532316.htmlTechArticlePHP counter $counterFile = balong.txt;//File name and path to store the value function displayCounter($counterFile) { $fp = fopen($counterFile,rw); $num = fgets($fp,5); $num += 1; pri...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn