注意事项

使用该缓存后可能会导致大部分插件及其功能失效

项目地址

github

配置说明

  1. 在插件/usr/plugins/目录下新建SaHtmlCache文件夹,并将Plugin.php上传到里面
  2. PHP.ini环境配置文件要改一下,将allow_url_include = On
  3. 永久链接(伪静态)设置为/{cid}.html (默认是{cid}.html,如需其他请自行更改Plugin.php)
  4. 在将/usr/plugins/SaHtmlCache文件夹下新建cache目录,并设为可读可写
  5. 修改站点根目录下index.php,添加以下代码
/**  SaHtmlCach 重定向到HTML静态文件 */
$safile = $_SERVER['REQUEST_URI'];
if(strpos($safile,'comment')<1){
    if ($safile=='/'||$safile=='index.php'){
        $safile = 'index.html';    
    }
    
    $sahtmlfile = './usr/plugins/SaHtmlCache/cache/'.$safile; 
    if(file_exists($sahtmlfile)){
        include($sahtmlfile);
        exit;
    }
}

效果验证

查看网页源代码,如果顶部有

SaCache created 2020/01/01 01:01:01

含有则表示生成成功,没有请查看设置

END
最后修改:2020 年 04 月 18 日
如果觉得我的文章对你有用,请随意赞赏