如何在5分钟后重定向到另一个页面?

bsa*_*neh 8 html javascript php timer

如何使用PHP在5分钟后重定向到另一个页面?

kay*_*ahr 15

如果您真的想使用PHP,请转到:

<?php header("Refresh: 300; URL=http://www.stackoverflow.com/"); ?>
Run Code Online (Sandbox Code Playgroud)


Arn*_*anc 12

只使用HTML:

<meta http-equiv="refresh" content="300;http://redirect-url" />
Run Code Online (Sandbox Code Playgroud)

这将http://redirect-url在300秒(5分钟)后重定向到.


Wil*_*zuk 5

Javascript的setTimeout()可能就是你想要的.一个例子是:

setTimeout(function(){ window.location = "<URL HERE>";}, 5*60*1000);
Run Code Online (Sandbox Code Playgroud)

window.location是你可以在javascript中使用来设置窗口的当前位置.但是,需要考虑的是,大多数浏览器不允许您在没有某种类型的用户输入之前设置window.location,例如点击.

看到这里