English 中文(简体)
Troublefire PHP fwrite: overwrite int for anti
原标题:Troubleshoot PHP fwrite: overwrite int for counter

快速拒绝: 这是我的第二个PHP项目,第一个描述性语言Ive与我合作。

这一小差不多是实施反射的门户。 确实如此,但并没有正确地增加。 档案编号:txt保留最初的0值(上线),并连续增加1比2行(每当其运行时,如“1111”)。 由此产生的反应是“经常计算:1”。

我所看到的几门辅导器,是想添加/选择的,然后是空洞(w)。 我试着这一点,这是绝对可行的。 我只想看能否加以巩固。 对于它为何绕过第二行或一般建议的任何见解都受到高度赞赏。

<?php
$countfile = "count.txt";
$counthandle = fopen($countfile, "r+");
$count = intval(@fread($counthandle, filesize($countfile)));
$count++;
echo "Current count: ";
echo $count . "<br/>
";
fwrite($counthandle, $count);
fclose($counthandle);
?>
问题回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签