In the active refresh, the program should constantly judge whether there is a new speech, if not repeat,
Here I introduce a method similar to C language programming effect
A time stamp because the general PHP script execution has a time limit
$delaytime = 0;
Cycle
while (1)
{
Judging whether there is a new statement, I $filename here to hold the total number of speeches, $last is the last statement that has been shown
$message = file ($filename);
$number = $message [0];
1 seconds delay
Sleep (1);
Time Stamp increase
$delaytime + +;
Exit the loop if the time stamp is close to the allowable script run time
if ($delaytime >) break;
Exit the loop if you have a new statement
if ($number > $last) break;
}
Handling Updates
... ...
This will not happen the page constantly refreshed, very annoying situation!!!
http://www.bkjia.com/PHPjc/532099.html www.bkjia.com true http://www.bkjia.com/PHPjc/532099.html techarticle in the active refresh, the program to constantly judge whether there is a new speech, if not repeat, here I introduce a similar C programming effect of the method//a time tag, because one ...