Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a .php file to a .html file?

Tags:

html

php

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...

like image 286
Greenhorn Avatar asked Nov 30 '22 11:11

Greenhorn


1 Answers

Here is a sample code:

<?php

ob_start();

// your PHP / HTML code here

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

?>
like image 129
Alix Axel Avatar answered Dec 09 '22 18:12

Alix Axel