2012-08-07 37 views
1

我不能沒有工作...頭()與延遲IE

<?php 
    header("Refresh: 5; URL=http://www.mywebsite.com"); 
?> 

...在Internet Explorer的工作(該死!)。

它在Chrome的偉大工程,如果我用...

header("Location: http://www.mywebsite.com"); 

...它工作在兩個,但我沒有得到任何的延遲。

+2

如果需要延遲,只是使用元刷新,或JavaScript。 – Brad 2012-08-07 20:47:51

+0

[PHP頭(「刷新」)問題]的可能重複(http://stackoverflow.com/questions/1884365/php-headerrefresh-problems) – GolezTrol 2012-08-07 20:51:26

回答

4

嘗試將其作爲元標記或通過JavaScript重新加載。

Meta標記:

<meta http-equiv="refresh" content="5;URL='http://example.com/'"> 

的Javascript:

window.onload = new function() { 
    setTimeout(function() { 
    location.reload(); 
    }, 5000); 
}; 
+0

謝謝!雖然我最終與location.href =「http://www.mywebsite.com」,因爲我想它重定向,而不是刷新:) – 2012-08-07 20:57:59

+1

@Oskwish沒問題。很高興它有幫助。 ;) – 2012-08-07 21:00:20