Re: file_get_contents
| From: | Richard Lynch | Date: | Sat, 09 Jun 2007 00:01:43 +0000 |
| Subject: | Re: file_get_contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256414@lists.php.net to get a copy of this message | ||
On Thu, June 7, 2007 2:39 pm, Chris Boget wrote:
> Does file_get_contents() not work with absolute paths?
Works for me.
In fact, I try to always use absolute paths so that I don't end up
affecting the totally wrong file.
> I'm able to
> successfully write data to a file that I create dynamically but when I
> go
> back to actually read the contents of the file, nothing seems to work.
> Not
> file_get_contents(), not file(), not fread() and not fgets();
>
> $mydata = 'joebobbriggs';
> $filename = 'c:\\temp\\my_file_name.txt';
> $resource = fopen( $filename, 'w+' );
> fwrite( $resource, $mydata );
> fclose( $resource );
Perhaps a clearstatcache() here is needed???
I wouldn't expect it to be, but maybe...
> echo 'File data: ' . file_get_contents( $filename );
>
> Nothing gets displayed but I see that the file was created and that it
> has
> the data I defined.
Can you run it in a second script and get the file contents, without
opening and writing the file first?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?