Re: Generating a Static HTML Page from PHP
| From: | Chris Hayes | Date: | Mon, 19 May 2003 23:07:27 +0000 |
| Subject: | Re: Generating a Static HTML Page from PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148228@lists.php.net to get a copy of this message | ||
At 00:51 20-5-2003, you wrote:
Is there a PHP function or some way to cause the HTML output from a PHP page to be sent directly to a file instead of the client (browser)? What I would like to do is use a PHP CLI and invoke this PHP script to generate a HTML page that can be served statically by the web server. I have thought about using something like JPCache but this will not do all the things I need.You could use: <?PHP ob_start();
//the entire script
// including HTML bits
// or
//include('whateverfile.php');
$contents=ob_get_contents();
ob_end_clean();
//now save $contents to file
?>