我想在給我發電子郵件後重定向用戶。
代碼將運行,除非我在email()
-方法之後(例如header()
-方法)放置了某些東西。
任何提示?php代碼中的標題重定向不起作用
function process()
{
$msg = "Form Contents: \n\n";
foreach($this->fields as $key => $field)
$msg .= "$key : $field \n";
$to = '[email protected]';
$subject = 'thesubject';
$from = $this->fields['email'];
mail($to, $subject, $msg, "From: $from\r\nReply-To: $from\r\nReturn-Path: $from\r\n");
header('Location: thanks.html');
}
你會得到什麼錯誤? –
我曾經在D:\ xampp \ php \ logs \ php_error_log – spamup
的D:\ xampp \ htdocs \ process_form.php中得到PHP Parse錯誤:語法錯誤,意外'header'(T_STRING),期望函數(T_FUNCTION)電子郵件發送沒有任何錯誤?如果您使用@mail(...)進行嘗試,該怎麼辦? – djot