RE: [PHP] include()ing into a variable
| From: | Jesse Castro | Date: | Thu, 14 Oct 2004 19:16:28 +0000 |
| Subject: | RE: [PHP] include()ing into a variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-199516@lists.php.net to get a copy of this message | ||
[snip]
$a=include("th-file.php");
[/snip]
Mag,
I have never seen this approach before.
This is the way I would do something like
that.
$file="./th-file.php";
if (!($fp = fopen($file,"r"))){
echo "Could not open ".$file;
exit();
}
$a = fread($fp, filesize($file));
fclose($fp);
See the following page for reference:
http://us2.php.net/manual/en/function.fopen.php
Cheers,
-jesse-