PHP Shuffle函数不适用于IE8和Chrome中的刷新

PHP Shuffle函数不适用于IE8和Chrome中的刷新,php,Php,我使用以下php shuffle函数代码显示图像列表: <?php $images = array(); $images['image1'] = array("id" => "sales1", "href" => "#salesperson1", "src" => "salesteam/salesteam-jessie.png"); $images['image2'] = array("id" => "sales2", "href" => "#sale

我使用以下php shuffle函数代码显示图像列表:

    <?php
$images = array();
$images['image1'] = array("id" => "sales1", "href" => "#salesperson1", "src" => "salesteam/salesteam-jessie.png");
$images['image2'] = array("id" => "sales2", "href" => "#salesperson2", "src" => "salesteam/salesteam-anthony.png");
$images['image3'] = array("id" => "sales3", "href" => "#salesperson3", "src" => "salesteam/salesteam-nicole1.png");
$images['image4'] = array("id" => "sales4", "href" => "#salesperson4", "src" => "salesteam/salesteam-kevin.png");
$images['image5'] = array("id" => "sales5", "href" => "#salesperson5", "src" => "salesteam/salesteam-christi.png");
$images['image6'] = array("id" => "sales6", "href" => "#salesperson6", "src" => "salesteam/salesteam-thomas.png");
$images['image7'] = array("id" => "sales7", "href" => "#salesperson7", "src" => "salesteam/salesteam-melissa.png");
$images['image8'] = array("id" => "sales8", "href" => "#salesperson8", "src" => "salesteam/salesteam-nicole2.png");
shuffle($images);
foreach ($images as $singleimage) {
$singleid = $singleimage['id'];
$singlehref = $singleimage['href'];
$singlesrc = $singleimage['src'];
echo "<li><a id=\"$singleid\" href=\"$singlehref\"><img src=\"$singlesrc\" /></a></li>";
}
?> 


在IE8或Chrome中点击刷新时,它都不起作用。它在Firefox中工作得很好。这是缓存问题吗

它来自缓存,您应该使用src$imagesrc.'?'.rand(0999)

echo“
  • ”;
    它来自缓存,您应该使用src$imagesrc.'?'.rand(0999)

    echo“
  • ”;
    您可以通过http头强制不缓存

    <?PHP
    header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
    header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
    header( 'Cache-Control: no-store, no-cache, must-revalidate' );
    header( 'Cache-Control: post-check=0, pre-check=0', false );
    header( 'Pragma: no-cache' ); 
    

    您可以通过http头强制不缓存

    <?PHP
    header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
    header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
    header( 'Cache-Control: no-store, no-cache, must-revalidate' );
    header( 'Cache-Control: post-check=0, pre-check=0', false );
    header( 'Pragma: no-cache' ); 
    

    执行硬刷新(Ctrl+F5),如果它在chrome/ie上工作,则这是一个缓存问题。硬刷新(上述刷新)不会改变ie或chrome中图像的顺序。在FF中使用硬刷新或定期刷新可以正常工作。执行硬刷新(Ctrl+F5),如果它在chrome/ie上工作,则是缓存问题。硬刷新(上述刷新)不会更改ie或chrome中图像的顺序。在FF中使用硬刷新或定期刷新效果很好。是的,我使用时间函数尝试了类似的事情。它似乎不起作用。在Chrome和IE8中,数字保持不变。你还有其他想法吗?是的,我用时间函数做了类似的尝试。它似乎不起作用。在Chrome和IE8中,数字保持不变。你还有其他想法吗?很遗憾,我无法访问此页面的标题。还有其他解决方案吗?很遗憾,我无法访问此页面的标题。还有其他解决办法吗?