Re: file_get_contents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux