Re: HTML file to a $var: Pls Help
| From: | @ Edwin | Date: | Sat, 26 Oct 2002 03:05:38 +0000 |
| Subject: | Re: HTML file to a $var: Pls Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121507@lists.php.net to get a copy of this message | ||
Hello,
"Shane" <shane@delaplaine.com> wrote:
> Any way to plug an entire HTML file into a variable?
>
> I looked into file_get_contents() but that was CVS format only.
>
True. But you can make your own. Something like this: --->
function file_get_contents($filename) {
$fp = @fopen($filename, "r");
if (!($fp)) {
return 0;
}
while (!feof($fp)) {
$temp .= fread($fp, 4096);
}
return $temp;
}
------------------------------------------------------------
That was from the manual:
http://www.php.net/manual/en/function.file-get-contents.php
Also, always check the "User Contributed Notes" for some good tips :)
HTH,
- E