note 48392 deleted from function.ob-get-contents by tularis
| From: | tularis@php.net | Date: | Wed, 22 Dec 2004 08:24:24 +0000 |
| Subject: | note 48392 deleted from function.ob-get-contents by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82165@lists.php.net to get a copy of this message | ||
Note Submitter: websurfer--nospam-- at digitalplatinum dot net
----
<?php
// Here is a simple example of capturing output to a string.
// This particular example is used as part of a
// content-management "publish" feature, implemented to
// generate static pages from dynamic pages, to reduce
// load on server/database yet still allow for a back-end
// database where owner can update content, etc.
// There are other ways of accomplishing this of course,
// but this has its advantages.
ob_start(); //start output buffering
include('dynamic_page.php'); //include the slow-loading dynamic page
$static_contents = ob_get_contents(); //capture output buffer to string
ob_end_clean(); //wipe output buffer and stop buffering
//output the fast-loading static page (PHP 5)
file_put_contents('static_page.php', $static_contents);
?>
----
Reason: useless example