Adnroid micro-letter built-in browser clear cache _php Tips

Source: Internet
Author: User
Tags php code rand browser cache

One of the headaches of micro-credit development is that caching is hard to erase, however, the strange thing is that micro-mail app in iOS can refresh the page, but the android does not know what to think about, can not clear the cache and no refresh function, this gives developers a no small obstacle, which has the best page is not changed, Then if to change, micro-letter browser cache css, pictures, so after the change to see the effect becomes relatively arduous.
I checked it on the Internet. Encounter this egg pain problem is not only I a, looking for but can not find the solution is not only me, some people say to micro-letter "Settings", "General" in the "clear micro-letter storage Space", I would like to ask, brother you have succeeded? This cleanup seems to be not cleaning up the cache, is to clean up their chat records Ah, even if you can clean out the cache, chat data is not, do you as a developer will be so bitter force, give yourself for the project?
Others say what anti-virus software, System tools to clean up storage space, I have tried, I feel like sometimes, sometimes not, and there is a tool software can not, the development of the most afraid of this time the spirit is not the spirit of the feeling, or to make either directly does not work, or repeatedly waste time in the inside.
......
Finally, I also did not fold, think of a way to think of it: after the file path plus a random number. What an enlightened man! For PHP to write the program that is more simple, using PHP to generate a random number, and then the HTML file path after adding this random number can be.

One, PHP development

PHP Code:

 $rand = rand (10000,99999);

HTML code:

  
 

Second, the use of Meta header information implementation to cancel the micro-trust browser cache

When you do a micro-credit public number and debug your mobile page, can not avoid the page to jump to the micro-letter browser open, debugging phase, the Android version of the micro-trust browser has always been the default caching of HTML static resources, each static resource changes and even when the new content is published in the micro-trust browser is very likely to not be updated, Most of the time to clean up the micro-mail cache to see the effect, it is annoying. Some customers installed QQ browser, micro-mail is actually called QQ Browser, and sometimes even light cleaning micro-letter cache is invalid, QQ browser cache also want to clear.

After some exploration of the micro-letter browser is indeed in the upper layer of the WebView cache: that is, if the request of this address, there will be local, and then do not take the line.

The solution is to add the following header information in the debug phase or frequently updated pages

<meta http-equiv= "Cache-control" content= "No-cache, No-store, must-revalidate"/> <meta "http-equiv=
" Pragma "content=" No-cache "/>
<meta http-equiv=" Expires "content=" 0 "/>

So the micro-mail browser on this page will be on the line pull.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.