Home > Backend Development > PHP Tutorial > php的计数器每次都会清零

php的计数器每次都会清零

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-02 11:34:29
Original
1070 people have browsed it

php






$count_num=0;
if(file_exists("counter.txt"))
{
$fp=fopen("counter.txt","r");
$counter_num=fgets($fp,9);//读取前八位数字
$count_num++;
fclose($fp);

}
$fp=fopen("counter.txt","w");
fputs($fp,$count_num);
fclose($fp);

echo" hahaha $count_num hahah";
?>

这个每次显示的都是1 就算人工修改了txt也不行 php初学者 请问问题出在哪里?谢谢!!

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template