2012-08-17 66 views
-4

我試圖做一個註冊和登錄系統,我在此代碼得到一個語法錯誤在那裏我使用PHP頭語法

header('Location: Profile.php'); 

在這段代碼的使用如下上下文:

/* send email to new Customer */ 
$emess = "You have sucessfully registered. "; 
$emess .= "Your new username and password are: "; 
$emess .= "\n\n\t$loginName\n\t"; 
$emess .= "$password\n\n"; 
$emess .= "We appreciate your interest. \n\n"; 
$emess .= "If you have any questions or problems, "; 
$emess .= " email [email protected]"; 
$subj = "Your new customer registration" 
# $mailsend=mail("$email","$subj","$emess"); 
header('Location: Profile.php'); 

任何幫助將不勝感激,因爲我學習PHP。

+3

**什麼**語法錯誤?如果你不告訴我們什麼是錯的,我們不能幫助我們。 – meagar 2012-08-17 13:13:14

+0

它不會拋出語法錯誤,但Location標頭表絕對URI,而不是相對的。 – Quentin 2012-08-17 13:14:09

+2

這是真的,該標準要求絕對網址,但大多數現代瀏覽器也可以處理相關的網址,所以這不是問題。 問題當然是缺少分號 – 2012-08-17 13:16:24

回答

10

你缺少一個分號:

$subj = "Your new customer registration"; 
+0

非常感謝,現在看起來很愚蠢。 – Scott 2012-08-17 13:18:24

+0

很高興幫助。任何人都可能遇到。 – 2012-08-17 13:19:28

2

如上面提到的,你缺少一個分號,當你有,你可以看看在日誌文件中的錯誤內部服務器錯誤

或在屏幕上啓用錯誤打印(DONT啓用它在製作中)與

ini_set("display_errors",true); 
error_reporting(E_ALL);