note 22691 added to function.unlink
| From: | dreamywind at yahoo dot com | Date: | Wed, 26 Jun 2002 21:21:55 +0000 |
| Subject: | note 22691 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32245@lists.php.net to get a copy of this message | ||
Don't know is this a bug or a feature of PHP. When I let the following code runs for like 20
seconds and close browser. Then run another PHP code that writes content to file $page. I either
sees no error and that the file $page does exist in the system. Or I see the file $page exist for
about 1 second and disappear. But after creating x time of file $page, file $page then will not be
deleted.
I wonder can it be that PHP is still running the code below which unlink the file or the unlink
commands are cached and execute.
while(1){
$contents="";
$fp=@fopen("$page", "r");
if($fp){
while(!feof($fp)){
$contents.=@trim(fgets($fp, 128));
}
fclose($fp);
}
if($contents!=""){
@unlink("$page");
}
sleep(2);
}
--
http://www.php.net/manual/en/function.unlink.php
http://master.php.net/manage/user-notes.php?action=edit+22691
http://master.php.net/manage/user-notes.php?action=delete+22691
http://master.php.net/manage/user-notes.php?action=reject+22691