Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > file_get_contents
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 15th March 13:08
chris.boget
External User
 
Posts: 1
Default file_get_contents



Does file_get_contents() not work with absolute paths? 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 );

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.

What's going on?

thnx,
Chris
  Reply With Quote


  sponsored links


2 15th March 13:08
robert
External User
 
Posts: 1
Default file_get_contents



That's the strangest absolute path I've ever seen... it seems to have
some kind of non-absolute prefix.
This has been a troll >

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
  Reply With Quote
3 15th March 13:08
chris.boget
External User
 
Posts: 1
Default file_get_contents


Pardon? I'm not sure what you mean?

thnx,
Chris
  Reply With Quote
4 15th March 13:08
robert
External User
 
Posts: 1
Default file_get_contents


Just jabbing at windows

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
  Reply With Quote
5 15th March 19:53
ceo
External User
 
Posts: 1
Default file_get_contents


Works for me.

In fact, I try to always use absolute paths so that I don't end up
affecting the totally wrong file.

Perhaps a clearstatcache() here is needed???

I wouldn't expect it to be, but maybe...


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?
  Reply With Quote
6 15th March 19:53
ceo
External User
 
Posts: 1
Default file_get_contents


I think it was a Windows-bashing joke...

But maybe using Linux style pathnames would work...

--
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?
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666