I have the following scenario.
I have a PHP website witch contains about 3 webpages with dynamic content. I want to render this to static content to another file. Eg. contact.php -> contact.html
My code looks like this
ob_start();
$content = require_once 'contact.php';
ob_end_flush();
file_put_contents("contact.html", $content);
Somehow this is not working ;-?(
require_once() doesn’t return the content outputted by a script. You need to get the script output that is stored in the output buffer:
ob_get_clean():
http://php.net/ob_get_clean