beh, non bisogna mai dimenticarsi che prima che uno script venga processato viene caricato completamente in memoria , quindi in qualche modo questa funzione rimane in attesa ....
ma è solo una supposizione la mia , non l'ho mai usata...
però un commento alla funzione dice
Although the documentation indicates it returns an int, I found comparing the return value with numeric values does not seem to work.
Example (does not work):
<?php
if (connection_aborted()==1) {
fwrite($filehandle, 'aborted!');
}
?>
You're better off just assuming it returns boolean
Example (does work):
<?php
if (connection_aborted()) {
fwrite($filehandle, 'aborted!');
}
?>
quindi
Codice PHP:
<?php
if (connection_aborted()) {
fwrite($filehandle, 'aborted!');
}
e sempre in una altro commento ho trovato questo
Codice PHP:
Very very useful!
I was building a chat and I wanted my script to detect when the browser was closed, so the user could be deleted from the online_users table.
<?
echo str_repeat(" ",300);
ignore_user_abort(true); //this way, the user can stop the output, but not the script.
while (true) {
echo "test
\n";
flush();
sleep(2);
if (connection_status()!=0){
include ('dbconnect.inc');
$sql="delete from online_users where online_user=$user";
$sql_exec=pg_exec($vChatDB, $sql);
die(); //kills the script
}
}
?>