RE: [PHP] fread problem
| From: | Martin Towell | Date: | Mon, 03 Mar 2003 04:49:14 +0000 |
| Subject: | RE: [PHP] fread problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137848@lists.php.net to get a copy of this message | ||
you'll have to exec() the code
$filename = "test.php";
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
exec($contents);
see if that works
Martin
> -----Original Message-----
> From: Paul Cohen [mailto:email@paulcohen.com]
> Sent: Monday, March 03, 2003 3:46 PM
> To: php-general@lists.php.net
> Subject: [PHP] fread problem
>
>
> Hello all,
>
> I am trying to read a php file to a varible and then print
> that variable.
> Unfortunately, my php file is not being parsed by the fread
> function and I
> can't figure out why.
>
> Here is the code in my file and was taken directly from the manual:
>
> $filename = "test.php";
> $handle = fopen ($filename, "r");
> $contents = fread ($handle, filesize ($filename));
> fclose ($handle);
> echo $contents;
>
> Here is test.php >>>
>
> <?PHP
> echo "Hello World";
> ?>
>
> <<< END test.php
>
>
> When I run this, I get a blank page with my php code as my
> HTML source code.
> Not good.
>
> Finally, if you respond to this, please copy me directly as I get the
> mailing list as a digest.
>
> Thx,
>
> Paul
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>