PHP generated HTML file code there are many ways, more commonly used for static use of the method, but we are using the direct generation of pure HTML file PHP code and method
PHP generated HTML file code there are many ways, more commonly used for static use of the method, but we are using the direct generation of pure HTML file PHP code and methods, let's take a look at
The first method is to use the Smary template to generate the form.
Require (' smarty/smarty.class.php ');
$t = new Smarty;
$t->assign ("title", "Hello world!");
$content = $t->fetch ("templates/index.htm");
Here the fetch () is the function that gets the output content, now inside the $content variable, is to display the content
$fp = fopen ("archives/2005/05/19/0001.html", "w");
Fwrite ($fp, $content);
Fclose ($FP);
?>
Another way is to use PHP od_get_contents to generate
Ob_start ();
echo "Hello world!";
$content = Ob_get_contents ();//Get all the contents of the PHP page output
$fp = fopen ("archives/2005/05/19/0001.html", "w");
Fwrite ($fp, $content);
Fclose ($FP);
The third method is to use PHP's natural function fopen to save directly.
http://www.bkjia.com/PHPjc/630487.html www.bkjia.com true http://www.bkjia.com/PHPjc/630487.html techarticle PHP generated HTML file code there are many ways, more commonly used for static use of the method, but we use the following is the direct generation of pure HTML file PHP code and method php generated HTML text ...