<?php
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
<?php
include("static.php");
createshtml();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
echo "移动技术网欢迎你,//www.jb51.net";
?>
</body>
</html>
将会生成一个 phpfans.html的静态页面
如果有参数,则用page来传递 如 phpfans.php?page=1
则生成 phpfans_1.html的静态页面
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
荐
数据库的设计
数据库的设计一 为什么需要规范的数据库设计数据库设计的步骤收集信息标识实体标识每个实体需要存储的详细信息标识实体...
[阅读全文]
-
-
-
-
-
-
-
-
-
-
网友评论