谷子原来的万网的免费主机,总是提升资源耗尽,停机于想到把WordPress 的首页变静态,不想用插件(本来就没有资源),找了一段PHP源码

功能:将 index.php  生成  index.html ,代码如下:

<?php
$baseCmsUrl = "https://www.kelegu.com";
$dmPageName = "index.php";
$stPageName = "index.html";
$tureStFile = dirname(__FILE__).'/'.$stPageName;
{
$body = file_get_contents($baseCmsUrl.'/'.$dmPageName);
$fp = fopen($tureStFile, 'w');
fwrite($fp, $body);
fclose($fp);
}
if(file_exists("index.html"))
{
unlink("index.html");
}
$baseCmsUrl = "https://www.kelegu.com";
$dmPageName = "index.php";
$stPageName = "index.html";
$tureStFile = dirname(__FILE__).'/'.$stPageName;
{
$body = file_get_contents($baseCmsUrl.'/'.$dmPageName);
$fp = fopen($tureStFile, 'w');
fwrite($fp, $body);
fclose($fp);
}
header("Location:$baseCmsUrl/index.html");
?>

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注