PHP disables page cache code. Core code: Copy the code as follows: header (Expires: Mon, 26Jul199705: 00: 00GMT); header (Last-Modified :. gmdate (D, dMYH: I: s ). GMT); header (Cache-Control: no-cache core code:
The code is as follows:
Header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT ");
Header ("Last-Modified:". gmdate ("D, d m y h: I: s"). "GMT ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("Pramga: no-cache ");
This is very useful for some pages. for example, the verification code must be different each time the verification code is generated. Otherwise, the verification code has no meaning, so you can use the preceding statement to disable caching.
For another example, "change a beautiful image every time you paste it back", the page cache must be disabled; otherwise, the same image will be returned in the cache.
Recently, I 've seen the alliance's blog on Baidu Union-"how to make netizens fall in love with your website" (mainly discussing how to improve user experience) come to a point:
Take the forum as an example. after a user logs on, the displayed page is "manage" and "modify information". after the user exits the forum, the user returns to the previous page again,
There are still "management" and "modify data" (because the cache page is returned). Although the cookie has been cleared at this time, "management" and "modify data" have no effect,
However, users still think that this is a valid page, so that others can also "manage", "modify information" and so on, and think that the website is not secure (although it is actually safe ). At this time, the above code is very useful on the page that requires cookie verification, at least to eliminate the adverse effects on user psychology.
The authorization code is as follows: header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified :". gmdate ("D, d m y h: I: s "). "GMT"); header ("Cache-Control: no-cache...