1.由于浏览器会对同一 url 的图像进行缓存,向减少服务器端的请求次数,提高浏览性能
随机数就是让每次点击刷新验证码的时候请求的 URL 路径都不同。告诉浏览器上个图片已经失效了,需要重新向服务器上请求新的图片信息。这样才能实现每次点击都会刷新验证码的效果,否则只有在页面刷新的时候验证码才会变,或者点击一次之后就不再变了,而这并不是我们想要的效果。
2.加时间戳是为了防止有些浏览器(IE等)偷懒不发送请求,直接匹配URL是否一致,一致就从缓存读取数据,不一致才重新发请求
3.1,标记版本。2,防止缓存。3,特殊处理,更具后缀返回不同信息等。