Hi all , i have a problem with php connection handling
<?
set_time_limit(0);
ignore_user_abort(TRUE);
echo "Start<br>\n";
$i = 1;
while (connection_status() == 0 && connection_aborted() == FALSE)
{
echo "Line $i<br>";
flush();
$i++;
sleep(1);
}
$f = fopen('test.txt' , 'wb');
fwrite($f , 'end');
fclose($f);
exit;
?>
The code is simple , i just want the script echo something while browser still connect and when the browser disconnect ( i press the stop button ) the script will open a file and write something to it .
But when i press the stop button T__T , or PHP stops immediately or it keeps running forever .
Can someone help me ! 🙁 😕