How do I deactivate caching in browsers?

后端 未结 3 1681
闹比i
闹比i 2021-01-22 07:22

For instance, if you exit your Yahoo mail and then click the back button, it will not load the last page, it will redirect you to the login page.

I have to do this with

3条回答
  •  温柔的废话
    2021-01-22 07:30

    The simple answer to avoid caching on the client browsers is to configure the Cache-Control HTTP response header.

    http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Avoiding_caching

    However, I don't have a PHP snippet with me to show you how to do it exactly. It should as simple getting the HTTP response object, and setting a header "Cache-Control" with value "no-store, must-revalidate"

提交回复
热议问题