我找到了这个链接用PHP中的Timer重定向?
我已经试过这个了
<meta http-equiv="refresh" content="5;url=http://yourdomain.com"/>
<?php
// wait 5 seconds and redirect :)
echo "<meta http-equiv='"refresh'" content='"5;url=http://yourdomain.com'"/>";
?>
它的工作,但我想重定向回上一页,知道吗?算法是我在5秒后更改页面,并希望在5秒后返回到上一页,然后继续返回。。抱歉我的英语不好
使用HTTP_REFERER,它将为您提供从当前页面到当前页面的页面。
$_SERVER['HTTP_REFERER']
参考:http://php.net/manual/en/reserved.variables.server.php
<?php
// wait 5 seconds and redirect :)
echo "<meta http-equiv='"refresh'" content='"5;url=".$_SERVER['HTTP_REFERER']."'"/>";
?>
使用window.go(-1);
有关详细信息,请参阅http://www.w3schools.com/jsref/met_his_go.asp
可以使用纯javascript
setTimeout(function(){
window.history.back()
}, 5000);
或者,如果你想使用php
setTimeout(function(){
window.location = '<?=$_SERVER['HTTP_REFERER'] ?>'
}, 5000);
您可以尝试重定向到
sleep(5);
$_SERVER['HTTP_REFERER']