Re: Re: file_set_contents() do several times?
| From: | David Otton | Date: | Mon, 20 Jul 2009 09:31:24 +0000 |
| Subject: | Re: Re: file_set_contents() do several times? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295603@lists.php.net to get a copy of this message | ||
2009/7/20 Martin Zvarík <mzvarik@gmail.com>:
>> 2009/7/20 Martin Zvarík <mzvarik@gmail.com>:
>>> <?php
>>> $i = 0;
>>> do {
>>> $i++;
>>> $r = file_put_contents('file.txt', 'content');
>>> } while($r === false && $i < 3);
>>>
>>> if ($r === false) die('error');
>>>
>>> ?>
>>>
> I am not appending anything, just ensuring that it will be written (and
> giving it max. 3 tryes).
Ok, don't do that. If it didn't work the first time, it won't work
0.001 seconds later, either. Chances are it will either be a
permissions error, or out-of-disc-space.