2014-12-24 101 views
-1

我正在製作一個腳本,將與phpVMS的登錄系統集成。無法修改標題信息 - 標題已發送(困惑)

我已經得到它的工作,如果有人去登錄的頁面會顯示。我該如何做到這一點,以便當有人打開網頁,沒有登錄,它將它們發送到登錄頁面?

目前,我得到的錯誤:

Cannot modify header information - headers already sent by (output started at /home/a4366948/public_html/mindfulhacker/private/man/index.html:11) in /home/a4366948/public_html/mindfulhacker/private/man/index.html on line 16

我看到另一篇關於這個同樣的問題,但我很困惑,我怎麼能有一個樣式表在同一時間的工作 - 有一個具有隻是沒有點一個未格式化的頁面!

<html xmlns="http://www.w3.org/1999/xhtml"><head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
     <meta http-equiv="Content-Language" content="en-gb"> 
<meta name="language" content="eng"> 
<meta name="resource-type" content="document"> 
     <link rel="stylesheet" href="style.css" type="text/css">   
        <title>Management System || CCVG</title> 
<?php include('/home/a4366948/public_html/core/codon.config.php'); ?> 
             </head> 
        <body> 
         <div class="container"> 
          <div class="pagetitle">CapitalConnect Virtual Group - Management System</div> 
          <?php 
           if(Auth::LoggedIn()) { 
          ?> 
          <div class="menu"><table class="tb_blue_full margin_10" align="center" border="0" cellpadding="0" cellspacing="0" width="780"><tbody><tr><td class="cell_blue_botright" height="25" width="260"><div align="center"><strong><a href="/home/login_sso.php">Away Status</a></strong></div></td><td class="cell_blue_botright" height="25" width="260"><div align="center"><strong><a href="/home/status.php">Students</a></strong></div></td><td class="cell_blue_bot" height="25" width="260"><div align="center"><strong><a href="/bookings/calendar.php">Classes</a></strong></div></td></tr></tbody></table></div> 
          <?php 
} else { 

header("Location: ".url('/login')); 
exit; 

} 
?> 
     <div style="clear: both;">&nbsp;</div> 
</div> 
</body></html> 

回答

2

您還有一些內容在您撥打header之前。這是禁止的。您必須將其移動到頂部,例如:

<?php 
    if(!Auth::LoggedIn()) { 
     header("Location: " . url("/login")); 
     die(); 
    } 
?> 
<html> 
<!-- … --> 
+0

OMG!謝謝,我不認爲這會很容易。 –

相關問題