Copy code The code is as follows:
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";//You can modify your static page path here
$fp = fopen($fileName,"wb");
fwrite($fp,$buffer) ;
fclose($fp);
return $buffer;
}
?>
For example
Save the above code Execute the following page phpfans.php for static.php
Copy the code The code is as follows:
include("static.php");
CreateShtml();
?>
Untitled Document
echo "Welcome to Script House, http://www.jb51.net";
?>
A static page of phpfans.html will be generated
If there are parameters, use page to pass such as phpfans. php?page=1
will generate the static page of phpfans_1.html
http://www.bkjia.com/PHPjc/318079.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318079.htmlTechArticleCopy the code as follows: ?php functionCreateShtml() { ob_start("callback_CteateShtml"); } functioncallback_CteateShtml($buffer) { $page=intval(@$_REQUEST["page"]); //$fileName=$_...