Home > php教程 > php手册 > PHP如何生成静态页面的函数

PHP如何生成静态页面的函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:33:15
Original
1257 people have browsed it

 如何生成静态页面的函数:

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();
?>



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template