Jump to content

file_get_contents


westman

Recommended Posts

as some of you may know php has got a smail bug with $file_in_put = file_get_contents('../theflie.php'); when i 1st used it i had no prob. am trying to get 1 file (html) content in to a verible (the file can be .php or .html any that works)what is the next best way to do this? ps. yes i looked at...http://php.net/manual/en/function.file-get-contents.phpbut still no help

Link to comment
Share on other sites

which bug are you refering to? what is happening when you run that code?

Link to comment
Share on other sites

i just tryed...$handle = fopen("../email/theemail.php", "rb");$email_in_put = stream_get_contents($handle);fclose($handle); but it did not work, i am runing php 5.2 am trying to get html code from 1 file in my directy in to a verible.any help?

Link to comment
Share on other sites

Can you explain what bug file_get_contents() has? I'm not aware of any. You're saying it doesn't work. What happens when you try the code? Are you getting an error message? Here's an example using fread():

$handle = fopen('../email/theemail.php', "rb");$email_in_put = fread($handle, filesize('../email/theemail.php') );fclose($handle);

Link to comment
Share on other sites

Turn error display on, i.e. add

ini_set('display_errors', 'On');error_reporting(E_ALL | E_STRICT);

At the top of your PHP file. Chances are that there'll be some sort of message telling you why it doesn't work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...