2015-09-27 27 views
0

我可以使用普通PHP刷新頁面。 如何使用CodeIgniter執行此操作?如何使用CodeIgniter中的header()函數刷新頁面並重定向到另一頁面

我是PHP嘗試這樣的:

<html> 
<title>Thank You</title> 
<body bgcolor="#E6E6FA"> 
    <center> 
    <h1>Thank You For Visiting...Wish you to visit again...</h1> 
    </center> 
    <?php 
    header(refresh:5; url="login_input.php"); 
    ?> 
</body> 
</html> 

我知道我必須這樣寫:

"<?php echo base_url();?>index.php/welcome/" 

但在哪裏呢?

我是否必須在模型和控制器中創建函數來執行此操作?

+2

頭功能只能之前加載頁面上的任何內容的利用。所以你的原始腳本甚至不應該工作。這就是說,笨有很大'redirect'功能https://ellislab.com/codeigniter/user-guide/helpers/url_helper.html – CollinD

+0

在所有名字的聖擺脫那些'

etc' –

+0

@CollinD :我的猜測是,它的工作原因是某些緩存服務器端延遲發送實際內容。 –

回答

0

謝謝大家回覆...並非常感謝Dan Belden先生提供鏈接以收集知識。

實際上是我尋找所需要的代碼如下...

<html> 
<title>Thank You</title> 
<head> 
<meta HTTP-EQUIV="REFRESH" content="5; url=<?php echo  
base_url();?>index.php/welcome/login"> 
</head> 
<body bgcolor="#E6E6FA"> 
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> 
<center><h1>Thank You For Visiting...Wish you to visit again....... 
</h1></center> 
</body> 
</html> 
相關問題