Re: PHP to HTML
| From: | Chris Shiflett | Date: | Mon, 08 Dec 2003 20:42:08 +0000 |
| Subject: | Re: PHP to HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172169@lists.php.net to get a copy of this message | ||
--- Steve Marquez <smarquez@marquez-design.com> wrote:
> Is there a way to have PHP write an HTML file?
Sure. This is no different from writing any other file.
If you want it to write a file instead of outputting the content, a
convenient way (my opinion) of doing this is to use ob_start() at the top
of your script, and then do something like this at the very end:
$html = ob_get_contents();
$fp = fopen('./foo.html', 'w');
fwrite($fp, $html);
fclose($fp);
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security Handbook
Coming mid-2004
HTTP Developer's Handbook
http://httphandbook.org/