[ACCEPTED]-Converting a .php file to a .html file?-html
Here is a sample code:
<?php
ob_start();
// your PHP / HTML code here
file_put_contents('where/to/save/generated.html', ob_get_clean());
?>
0
Not sure if I understand the question right.
But 2 you can generate html files from php over 1 command line:
php index.php > index.html
Another option is to use apache's mod_rewrite 5 or the IIS equivelant to rewrite your URL's 4 from the browser perspective.
This would 3 require no coding change, make sure the 2 Apache extension is installed and add this 1 to the .htaccess file of your root web directory:
RewriteEngine on
RewriteBase /
RewriteRule ^([^/]*)\.html$ $1.php?%{QUERY_STRING} [NC]
you can use output buffering (ob_start
, etc.) and 2 then write the content of the buffer to 1 a file at the end of your script
If these are not options, you 2 can always curl
to the page if it's running 1 on a web server/
It looks like you want to save a static 2 version of a dynamic web site. A tool like 1 WinHTTrack comes in handy.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.