Greenhorn Greenhorn - 28 days ago 14
PHP Question

Converting a .php file to a .html file?

I have a .php file which has several queries in it. I want the output file as a .html file...

Is there any way to do this. I am currently doing this by saving, using my browser, that executed PHP file, as an .html file. But when I launch my product that should not be the case of the client.

Please suggest a way, thanks in advance...

Answer

Here is a sample code:

<?php

ob_start();

// your PHP / HTML code here

file_put_contents('where/to/save/generated.html', ob_get_clean());

?>