Core code:
Copy 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 for It is very useful for certain pages, such as verification code, because the verification code generated must be different each time, otherwise the verification code will have no meaning, so you can use the above statement to disable caching.
Another example: "Change a picture of a beautiful woman every time you post". Page caching must be disabled, otherwise the same picture in the cache will be returned.
I recently saw the "League Chronicles" on Baidu Alliance - "How to make netizens fall in love with your website" (mainly discussing how to improve user experience) and thought of one thing:
Take the forum as an example, when the user logs in, what is displayed is Pages after login such as "Management", "Modify Information", etc., when the user exits the forum and returns to the previous page, there are still "Management", "Modify Information", etc. (because the cached page is returned), although this At that time, the cookies have been cleared, and "Manage", "Modify Information", etc. no longer work.
But the user still thinks that this is a valid page, and thus thinks that others can also "Manage", "Modify Information", etc., thinking that the website is not valid. Safe (although actually safe). At this time, it is very useful to add the above code to the page that requires cookie verification. At least it can eliminate the negative impact on the user's psychology.
The above introduces the Xi'an Aviation Technology College code and PHP code that prohibits page caching, including the content of the Xi'an Aviation Technology College code. I hope it will be helpful to friends who are interested in PHP tutorials.