Home  >  Article  >  Backend Development  >  某些浏览器缓存验证码,罗致重新打开该页面时总提示验证码过期

某些浏览器缓存验证码,罗致重新打开该页面时总提示验证码过期

WBOY
WBOYOriginal
2016-06-13 12:01:481385browse

某些浏览器缓存验证码,导致重新打开该页面时总提示验证码过期。
刷新浏览器就正常。
怎么解决,有什么代码可以强行让验证码重新载入的。
------解决方案--------------------
生成地址后面加个js随机参数,url?r=Math.random()
------解决方案--------------------
某些浏览器缓存验证码,罗致重新打开该页面时总提示验证码过期

------解决方案--------------------
某些浏览器缓存验证码,罗致重新打开该页面时总提示验证码过期">
------解决方案--------------------
你在验证码图片生成程序中加入禁止缓存的头

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past<br />header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");<br />header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1<br />header ("Pragma: no-cache");                          // HTTP/1.0<br />
就可一劳永逸的解决这个问题,而不必每到使用时去改变url

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn