Home >Backend Development >PHP Tutorial >PHP Counter_PHP Tutorial

PHP Counter_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 16:54:22796browse



 $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"." The guy looking at the counterFile";
exec( "rm -rf $counterFile");
exec( "echo $num > $counterFile");
}

if ( !file_exists($counterFile)) {
exec( "echo 0 > $counterFile");
}
displayCounter($counterFile);

?>

http://www.bkjia.com/PHPjc/631774.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631774.htmlTechArticle?php $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...
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