You are here: using echo but need something to execute php code « PHP Programming Language « IT news, forums, messages
using echo but need something to execute php code

Posted by Jon Slaughter on 04/28/07 21:16

I have some code that loads up some php/html files and does a few things to
them and ultimately returns an html file with some php code in it. I then
pass that file onto the user by using echo. Of course then the file doesn't
get seen by the user.

Is there any command that essentially executes the code and then echo's it?

something that will take a string like

'<body>blah<?php echo 'Hello'; ?></body>' and actually interpret the php
code?

e.g., doing

echo '<body>blah<?php echo 'Hello'; ?></body>';

does me no good caues the php code isn't interpreted.

Saving it to a file and then redirecting the user to that file so it will be
executed seems like a roundabout way and causes more problems.


essentially I am trying to include php/html files in one another but I need
to do some parsing on them first. I'd rather not do something like


file_get_contents($Page)
parse($Page)
save($Page)
include "$Page"


as it seems uncessary to have to write the page to disk just to include it.

At

http://us2.php.net/include/


"Another way to "include" a PHP file into a variable is to capture the
output by using the Output Control Functions with include(). For example:"

Seems like I might be able to use that to replace when I use
file_get_contents to get the php code to execute?



Thanks,
Jon

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация