说10秒钟后如何使用PHP进行重定向...
How can I make a redirect with PHP after say 10 seconds...
我已经阅读了大量有关它的内容,似乎使用javascript会更好.但是PHP可以节省很多代码.
I have read alot about it, seems like it would be better with javascript. But PHP would save me alot of coding.
那么如何在PHP中使用计时器进行重定向?
So how can I make a redirect with timer in PHP ?
谢谢
推荐答案您可以使您的PHP脚本休眠10秒钟,
You can cause your PHP script to sleep for 10 seconds,
sleep(10);,但这对于最终用户将显示为无响应服务器.最好的选择是使用元刷新,
but this will appear to the end-user as a non-responsive server. The best option is to use either a meta refresh,
<meta http-equiv="refresh" content="10;url=google">或javascript.
or javascript.
setTimeout(function(){ window.location = "google"; }, 10000);
在丹尼尔的评论中找到:
Found in the comments from Daniel:
header('Refresh: 10; URL=yoursite/page.php');对于这种情况将是理想的,因为它不需要Javascript或HTML.
would be ideal for this situation, as it requires no Javascript or HTML.
更多推荐
在PHP中使用Timer重定向?
发布评论