Home >Backend Development >PHP Tutorial >Radio enthusiasts PHP function to generate static pages, recommended by PHP enthusiasts site
Copy the 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;
}
?>
Copy the code The code is as follows:
include("static.php");
CreateShtml();
?>
The above introduces the PHP function for generating static pages for radio enthusiasts. Recommended by the PHP Enthusiast Station, including content about radio enthusiasts. I hope it will be helpful to friends who are interested in PHP tutorials.