1. Overview
Cache-control is used to control HTTP cache (may not be partially implemented in HTTP/1.0, only Pragma: no-cache is implemented)
2. Example
Cache-Control: cache-directive
cache-directive can For the following:
request is used:
no-cache
no-store
max-age = delta-seconds
max-stale = delta-seconds
min-fresh = delta-seconds
no-transform"
only-if -cached"
cache-extension"
response is used:
public
private = <> field-name <">
no-cache = field-name
no-store"
no-transform
must -revalidate
proxy-revalidate
max-age = delta-seconds
s-maxage = delta-seconds
cache-extension"
3. Analysis
Cache-control: max-age=5
means 5 after visiting this webpage Accessing again within seconds will not go to the server
Cache-Control: no-cache: This can easily cause misunderstanding, making people mistakenly think that the response is not cached.
In fact, Cache-Control: no-cache will be cached, but every time when response data is provided to the client (browser),
the cache must evaluate the validity of the cached response to the server.
Cache-Control: no-store: This means that the response is not cached.
The above introduces PHP knowledge point 3-HTTP header-Cache-Control, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.