|
Hello - I am trying to read the contents of a local file, and echo the contents. I'm able to do this using the various FILE functions, but I'm stuck on the following issue ...
My resulting echo is echoing the embedded PHP code literally.
For example my called "file.inc" has the following contents with embedded PHP:
<? $word = "hello"; ?>
He said <?=$word?> to the dog.
I want to read the contents of the above file and echo it back. I want it to display the processed "He said hello to the dog" and not the literal code which resides in the file.
I tried doing a simple command
echo include ("file.inc");
but that produced:
"He said hello to the dog1" <---- note the appended 1
I'm figuring the 1 is returned because the include worked and thus was true.
Hoping all of the above makes sense ... I'm trying to echo back the contents of a file, but also want those contents to execute the embedded PHP code, not just parrot it back.
Thanking the responder in advance ...
|