我为wordpress编写了一个插件,我希望它每3个小时刷新一次我尝试使用标题(“刷新:10800; url = example.php”),但我无法得到任何结果。
感谢您的帮助。
答案 0 :(得分:0)
您可以尝试使用javascript:
setTimeout(function(){ window.location = 'example.com' },10800)
让我们知道你如何在3个半小时左右开始......
答案 1 :(得分:0)
你在PHP header()
函数和HTML HEAD部分之间感到困惑。
PHP header( 'Location: newpage.htm' );
执行即时重定向到 newpage.htm (并且应该直接调用die()
)。没有可能延迟重定向。
在HTML <head> ... </head>
部分中,您可以使用META标记执行延迟刷新或重定向:
<!-- Refresh the Current Page every 10 minutes (600 seconds) //-->
<meta http-equiv="refresh" content="600">
<!-- Redirect to Another Page with a Delay of 10 minutes (600 seconds) //-->
<meta http-equiv="refresh" content="600;url=http://anotherserver.com/">