Re: getting file contents
| From: | Alex Earl | Date: | Wed, 11 Jun 2003 15:56:17 +0000 |
| Subject: | Re: getting file contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151098@lists.php.net to get a copy of this message | ||
> I have text a file which contains php code. I am using it as a template
> for some other pages. I want to take everything in that file and store it
> in a string or array and then output it all to an empty file (this will
> make both files look exactly the same). I am using the
> file_get_contents() function to do this, but it seems to have trouble
> because it looks like it is trying to execute the php code in the file I
> am trying to get. Anyone know of a better way to go about this? Thanks.
>
> Matt
$file_data = join( '', file( '/path/to/file' ) );
Alex