我試圖發送一封電子郵件與幾個換行符,但每次我添加\r\n
,它不斷吐出一個錯誤,任何人都知道它爲什麼這樣做?將換行符添加到電子郵件時出現警告錯誤?
錯誤
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home3/hutch/public_html/server1/ForgotPassword.php on line 24
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home3/hutch/public_html/server1/ForgotPassword.php on line 24
Parse error: syntax error, unexpected T_STRING in /home3/hutch/public_html/server1/ForgotPassword.php on line 24
PHP
<?php
if (isset($_GET['Username'])){
$Username = $_GET['Username'];
if (is_dir("USERS/".$Username) === true) {
$myFile=fopen("USERS/".$Username."/Password.txt","r") or exit("Can't open file!");
$Password = fgets($myFile);
fclose($myFile);
require("PHP/class.phpmailer.php");
require("PHP/class.smtp.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.sulmaxmarketing.com";
$mail->From = "[email protected]";
$mail->FromName = "Online Game";
$mail->AddAddress("[email protected]");
$mail->Subject = "Forgot Password";
$mail->Body = "You have requested your login details, if this is incorrect please reply to this email letting us know your account has been compromised.".\r\n."Username: ".$Username.\r\n."Password:".$Password;
if(!$mail->Send()) {
echo 'Failed to send password to email. Please contact support.';
}
else {
echo 'An email has been sent to your email address associated with the account.';
}
}
else {
echo 'Username not found!';
}
}
?>
你忘記了報價。是$ var = $用戶名 「\ n」 「你好。」; –