You are here: Re: run php on a script, from a script « PHP Programming Language « IT news, forums, messages
Re: run php on a script, from a script

Posted by Albe on 10/13/70 11:39

On Thu, 09 Feb 2006 10:48:35 +0200, Jasen Betts <jasen@free.net.nz> wrote:

> On 2006-02-08, Fred Paris <nono@nono.invalid> wrote:
>> 2)
>> I also have a script, script.php
>>
>> 3)
>> When script.php runs, I want it to run php on template.php, and write
>> the resulting html output to a file.
>
> use "ob_start"(etc...) to capture output and "require" to run the
> external
> php script.

There is another way to do it. You can eval() the code inside template.php.

<?php
$fc = file_get_contents("template.php");
$result = eval(" ?>".$fc."<?php ");
$fh = fopen("resultfile.html", w);
fwrite($fh, $result);
fclose($fh);
?>

 

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

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