开发者

How to refresh wordpress plugin in a period of time that i selected?

开发者 https://www.devze.com 2023-02-19 21:02 出处:网络
I wrote a plugin for wordpress and i want it to refresh in every 3 hours i tried header(\"refresh:10800;开发者_如何学编程url=example.php\") but i couldn\'t get any result.

I wrote a plugin for wordpress and i want it to refresh in every 3 hours i tried header("refresh:10800;开发者_如何学编程url=example.php") but i couldn't get any result.

Thanks for your helps.


you could try with javascript:

setTimeout(function(){ window.location = 'example.com' },10800)

let us know how you get on in 3 1/2 hours or so...


You've gotten confused between the PHP header() function and the HTML HEAD section.

The PHP header( 'Location: newpage.htm' ); performs an instantaneous redirect to newpage.htm (and should be directly followed by a call to die()). There is no potential to delay that redirection.

Within the HTML <head> ... </head> section, you can use a META Tag to perform a delayed refresh or redirection:

<!-- 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/">
0

精彩评论

暂无评论...
验证码 换一张
取 消