Home >Backend Development >PHP Tutorial >Example of the simplest way to generate a static HTML page with PHP, static is the simplest_PHP tutorial
PHP file name: dome.php
Copy code The code is as follows:
$string = 1;
Ob_start();
@readfile("templets/list.html");
$text = ob_get_flush();
$myfile = fopen("list.html","w");
$text = str_replace ("{counent}",$string,$text);
fwrite($myfile,$text);
Ob_clean();
?>
Template file name: templets/list.html
Copy code The code is as follows:
User: {counent_user} Title: {counent_title} Release time: {counent_lastdate} |
Content: {counent_content} |