我有一个
PHP脚本用于在网站上旋转横幅图像.
在Firefox / IE页面刷新将发出另一个请求,将返回不同的图像.
在Chrome下,请求似乎已缓存,只有在新选项卡中打开页面才会使其实际查询脚本.
我相信这曾经在旧版本的chrome中工作,我尝试了几种不同类型的重定向代码都具有相同的结果.
有小费吗?
< img class =“banner”src =“/ inc / banner.PHP”alt =“”>
~$cat /var/www/inc/banner.PHP <?PHP header("HTTP/1.1 302 Redirect"); header("Cache-Control: max-age=0,no-cache,no-store,must-revalidate"); //header('HTTP/1.1 307 Temporary Redirect'); //header("expires: none"); //header("expires: max"); //header("Cache-Control: public"); $folder = '../img/banner/'; $exts = 'jpg jpeg png gif'; $files = array(); $i = -1; if ('' == $folder) $folder = './'; $handle = opendir($folder); $exts = explode(' ',$exts); while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { // for each extension check the extension if (preg_match('/\.'.$ext.'$/i',$file,$test)) { // faster than ereg,case insensitive $files[] = $file; // it's good ++$i; } } } closedir($handle); // We're not using it anymore mt_srand((double)microtime()*1000000); // seed for PHP < 4.2 $rand = mt_rand(0,$i); // $i was incremented as we went along header('Location: '.$folder.$files[$rand]); flush(); ?>
卷曲输出;
~$curl -I -k https://example.net/inc/banner.PHP HTTP/1.1 302 Redirect Server: Nginx/1.1.14 Date: Fri,24 Feb 2012 03:23:46 GMT Content-Type: text/html Connection: keep-alive X-Powered-By: PHP/5.3.10-1ubuntu1 Cache-Control: max-age=0,must-revalidate Location: ../img/banner/2.jpg
铬中的错误:
http://code.google.com/p/chromium/issues/detail?id=103458
http://code.google.com/p/chromium/issues/detail?id=103458