Register_shutdown_function does not work
| From: | Martin | Date: | Thu, 26 Oct 2000 12:37:23 +0000 |
| Subject: | Register_shutdown_function does not work | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22125@lists.php.net to get a copy of this message | ||
Hi !
I'm downloading a file via ftp to my server. The file should be
destroyed IN ALL CASES when then script ends - but it isn't.
Have a look at the following code-snippet. I register "OnShutdown" as a
Shutdown-Function, but the filename isn't unlinked when the script
terminates. Calling OnShutdown directly deletes the file (just as a
"debug-test").
Any ideas, why OnShutdown isn't called when the script terminates ?
Martin
<?php
register_shutdown_function("OnShutdown");
$tmp_filename = ""; // Temp Filename on server
function OnShutdown()
{ global $tmp_filename;
if ($tmp_filename != "")
{ unlink($tmp_filename);
$tmp_filename = "";
}
}
class Download
{... class to download file
};
?>