Re: getting file contents

From: Date: Thu, 12 Jun 2003 01:24:42 +0000
Subject: Re: getting file contents
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151177@lists.php.net to get a copy of this message
you could do something like this $buffer = ''; $fd = fopen($filename, 'r'); while (!feof($fd)) { $buffer .= fgets($fd, 4096); } fclose($fd); a better option would probably be to make your "text" file a "php" file and echo your value where you want them <? // php code here include 'mytemplate.php'; ?> note: whatever you include will be parsed if it has php tags, regardless of the file extension olinux --- Matt Palermo <mpalermo@vt.edu> wrote: > 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 > __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

« previous php.general (#151177) next »