如何以编程方式烘烤静态HTML文件? [英] PHP - How to programmatically bake out static HTML file?
问题描述
你如何以编程方式将动态PHP文件转换为静态HTML文件,显然将所有动态PHP相关值作为静态HTML进行烘焙?
ob_start();
?>
在脚本的最后,放置这个:
<?php
$ myStaticHtml = ob_get_clean();
//现在你的静态页面在$ myStaticHtml
?>
输出缓冲引用:
http://php.net/ manual / zh / book.outcontrol.php
http://www.php.net/manual/en/function.ob-start.php
http://www.php.net/manual/en/function.ob-end-clean.php
How do you programmatically convert a dynamic PHP file into a static HTML file, that would obviously have all dynamic PHP-related values baked in as static HTML?
As the beginning of your script place this:
<?php
ob_start();
?>
At the very end of the script, place this:
<?php
$myStaticHtml = ob_get_clean();
// Now you have your static page in $myStaticHtml
?>
Output buffering reference here:
http://php.net/manual/en/book.outcontrol.php
http://www.php.net/manual/en/function.ob-start.php
http://www.php.net/manual/en/function.ob-end-clean.php
这篇关于如何以编程方式烘烤静态HTML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!