faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 8 people (63%) answered Yes
Recently 5 of 8 people (63%) answered Yes

Entry

Is there any way to execute a PHP file (like with include) but direct its output to a variable?

Mar 15th, 2008 18:31
ha mo, Brandon Tallent, Eric Naeseth,


Yes.  Take a look at the output buffering functions in the php manual:
http://us3.php.net/manual/en/ref.outcontrol.php
If you turn on output buffering at the beginning of your script, you can
use ob_get_contents to capture the output into a variable of your choice.
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com