问题
I wrote a script that copies files into another directory. And it sometimes works and sometimes doesn't work. It honestly baffles me.
I'm using it to copy image files from one directory to another. Something like this.
$src = "images/" . $filename;
$dest = "temp_dir/" . $filename;
$result = copy($src,$dest);
var_dump($result);
Sometimes it works, and sometimes it just doesn't copy, even though the result always always always says TRUE. It seems that after I copy, it stops working for a few minute then will work again, then stop again for a few minutes.
Is this a problem with memory being tied up? Or is a stream being opened that I need to close? Or something weird like this?
Please help.
来源:https://stackoverflow.com/questions/22418849/php-copy-a-file-is-only-working-some-of-the-time