zoukankan      html  css  js  c++  java
  • PHP静态页生成

    1.output_buffering=on //开启缓存区 默认开启
    2.获取缓存区内容函数

    ob_start() //打开输出控制缓存
    ob_get_contents() //返回输出缓存区内容
    ob_clean() //清空(擦掉)输出缓存区
    ob_get_clean() //得到当前缓存区内容并删除当前输出缓存区
    

    3.php生成文件函数

    file_put_contents('index.html',ob_get_contents());
    

    4.如何触发系统生成纯静态化页面
    1)页面添加缓存时间

    is_file('index.html') //判断页面是否存在
    filemtime('index.html')//判断页面是否超时,一般与time()当前时间做对比。
    

    2)手动触发方式
    点击按钮 触发函数所在php文件

    3)crontab 定时扫描程序

     */5 * * * * php /var/www/html/index.php
    

    5.局部动态化页面
    运用ajax调用数据

  • 相关阅读:
    Mybatis入门
    Ajax
    产品经理之产品规划
    产品经理之用户研究(下)
    产品经理之用户研究(上)
    Spring Cloud
    Spring MVC
    synchronized
    Spring Boot入门
    Spring
  • 原文地址:https://www.cnblogs.com/heanwanfeng/p/14613937.html
Copyright © 2011-2022 走看看