时间:2021-07-01 10:21:17 帮助过:3人阅读
function CreateShtml()
{
ob_start("callback_CteateShtml");
}
function callback_CteateShtml(buffer)
{
page = intval(@_REQUEST["page"]);
//fileName = _SERVER['DOCUMENT_ROOT'] . dirname(_SERVER['PHP_SELF']) . "/article/" . basename(_SERVER['PHP_SELF'],".php") . (page==0 ? "" : "_" . strval(page)) . ".html";
fileName = basename(_SERVER['PHP_SELF'],".php") . (page==0 ? "" : "_" . strval(page)) . ".html";//可以在这里修改你的静态页面路径
fp = fopen(fileName,"wb");
fwrite(fp,buffer);
fclose(fp);
return buffer;
}
?>举个例
把上面的代码保存为 static.php
执行下面页面 phpfans.php
CODE:[复制到剪切板] include("static.php");
CreateShtml();
?>
无标题文档
echo "php爱好者站欢迎你,http://www.phpfans.net";
?>
http://www.bkjia.com/PHPjc/815030.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/815030.htmlTechArticle如何生成静态页面的函数: ?php function CreateShtml() { ob_start(callback_CteateShtml); } function callback_CteateShtml(buffer) { page = intval(@_REQUEST[page]); //fileN...