更新时间:2023-12-05 21:10:16
有些浏览器更具有侵略性比其他默认的缓存。不过,也有您可以发送指示何时重新加载$ C $ C缓存控制头。
Some browsers are more agressive with default caching than others. However, there are cache control headers you can send to indicate when to reload the code.
header("Expires: " . date("r", time() + ( 60 * 60 * 24 * 7 * 1 ) ) ); // Expires in 1 week
header("Content-Type: application/x-javascript");
是一个code-片段我已经知道使用。
Is a code-snippet I've been known to use.
您可以使用更花哨的东西,如若非-Modified头和ETag,而到期时间是消除额外的服务器调用唯一的。
You can use more fancy stuff like If-Not-Modified headers and ETags, but Expire times are the only ones that eliminate extra server calls.