我有一个PHP页面,它从API获取价格,我希望它不会缓存任何内容,因为我已将页面设置为每15秒<meta http-equiv="refresh" content="15">
重新加载所以价格可以是更新。
我已将以下代码添加到我的index.php文件中,但是当我以隐身模式打开Google Chrome时,它似乎仍会缓存,(有时)我看到不同的数字。
在<body>
我有:
<?php
$ts = gmdate("D, d M Y H:i:s") . " GMT";
header("Expires: $ts");
header("Last-Modified: $ts");
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
?>
此外:
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
我还在我的代码开头使用了这个:<html manifest="manifest.appcache">
,其中包含以下内容:
CACHE MANIFEST
# Cache manifest version 1.0
# no cache
NETWORK:
*
BTW,第一块PHP代码是不是正在完成第二块PHP代码正在做的事情?是否有必要同时使用它们?另外,当我尝试使用php时,manifest.appcache失败的目的是什么?