<?php
$to = "[email protected]";
$subject = "Reparasjon av " . $_REQUEST['type'] . " fra mysite.no";
$types = if(!empty($_REQUEST['type'])) {echo($_REQUEST['type'] . ". ");};
$reps = if(!empty($_REQUEST['rep'])) {echo($_REQUEST['rep']);};
$message = $types . . $reps . "\n\nKommentarer:\n" . $_REQUEST['kommentarer'] . "\n\nFra:\n" . $_REQUEST['navn'] . "\nTelefon: " . $_REQUEST['telefon'] . "\nEmail: " . $_REQUEST['email'] . "\nBosted: " . $_REQUEST['bosted'];
$headers = "From: " . $_REQUEST['email'] . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
if (mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $headers)) {
header('Location: http://www.mysite.no/');
} else {
header('Location: http://www.mysite.no/');
}
?>
它說第4行有T_IF錯誤。什麼問題?這個T_IF錯誤是什麼意思?
它意味着 「發現'Token_IF'('if')其中'if'是無效的」。請參閱therin的答案,瞭解它爲什麼不是一個有效的表達式(只有表達式可以用作右值)。 – 2011-09-08 21:57:54