zoukankan      html  css  js  c++  java
  • Pragma: nocache

    PHP Advanced and Object-Oriented Programming
    Larry Ullman
     
    Last-Modified 最后修改时间
    Expires 过期时间
    Pragma 编译提示
    Cache-Control 缓存控制
    如缓存系统发现Last-Modified的值比页面缓存版本的时间更接近当前时间,它就知道应该使用来自服务器的更新页面版本。
     

    Caching—both in Web browsers and proxy servers—can be affected using PHP’s header() function. Four header types are involved:

    • Last-Modified

    • Expires

    • Pragma

    • Cache-Control

    The first three header types are part of the HTTP 1.0 standard. The Last-Modified header uses a UTC(Coordinated Universal Time) date-time value. If a caching system sees that the Last-Modified valueis more recent than the date on the cached version of the page, it knows to use the new version from the server. Expires is used as an indicator as to when a cached version of the page should no longer be used (inGreenwich Mean Time).

    Setting an Expires value in the past should always force the page from theserver to be used:

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    Pragma is just a declaration for how the page data should be handled. To avoid caching of a page, use

    header("Pragma: no-cache")

    The Cache-Control header was added in HTTP 1.1 and is a more finely tuned option.

    Directive         Meaning

    public        Can be cached anywhere

    private           Only cached by browsers

    no-cache          Cannot be cached anywhere

    must-revalidate  Caches must check for newer versions

    proxy-revalidate  Proxy caches must check for newer versions

    max-age      A duration, in seconds, that the content is cacheable

    s-maxage     Overrides the max-age value for shared caches

    Keep all systems from caching a page

    header("Last-Modified: Mon, 26 Jul 2016 05:00:00 GMT"); //Right now!

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Way back then!

    header("Pragma: no-cache");

    header("Cache-Control: no-cache");

  • 相关阅读:
    php 将富文本编辑后的内容取出
    阿里云Windows远程连接出现身份验证错误,要求的函数不正确”的报错。
    composer切换中国镜像
    php获取当月天数及当月第一天及最后一天、上月第一天及最后一天实现方法
    golang ioutil 包源码阅读
    ssh 远程登录 REMOTE HOST IDENTIFICATION HAS CHANGED 问题
    Golang -- fallthrough
    Golang 执行 go run main.go 显示 undefined
    Golang Playground 进度条示例
    关系型数据库和非关系型数据库(NOSQL)
  • 原文地址:https://www.cnblogs.com/rsapaper/p/5844232.html
Copyright © 2011-2022 走看看