私はいくつか改行を入れて電子メールを送信しようとしていますが、毎回\r\n
を追加するたびに、これがなぜこのようになっているのか誰にもわからないエラーが出てきます。電子メールに改行を追加する際の警告エラー?
ERROR
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 = $ username。 "\ n"。 "こんにちは"; –