note 23370 added to function.register-shutdown-function
| From: | enygma at phpdeveloper dot org | Date: | Tue, 16 Jul 2002 19:37:01 +0000 |
| Subject: | note 23370 added to function.register-shutdown-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33180@lists.php.net to get a copy of this message | ||
I figured I'd share this since I got it working on my box.... this lets you run the
"bye" function if the page ends normally or they stop it.
<?php
set_time_limit("0");
function bye(){
//this is run when the page ends
if(connection_aborted()){
//this just means that the user hit the stop button or something
}
}
register_shutdown_function('bye');
$count=100000000000000;
for($i=0; $i<$count; $i++){
#sit here and loop for a bit so we can have time to hit Stop...
echo " \n";
}
echo "end";
?>
I figured it might be useful to someone out there trying to run a function when the page ends (or is
stopped).
--
http://www.php.net/manual/en/function.register-shutdown-function.php
http://master.php.net/manage/user-notes.php?action=edit+23370
http://master.php.net/manage/user-notes.php?action=delete+23370
http://master.php.net/manage/user-notes.php?action=reject+23370