有人告诉我,在输出到屏幕时必须使用htmlspecialchars()
,但是我在$ headers'部分下需要它吗,因为我无法使用它:
$company = "pianocourse101@hotmail.com";
$subject = "Activate your Premium membership Level 1 monthly account";
$mailTo = htmlspecialchars($email);
$headers = "From: ",htmlspecialchars($company);
$txt = "Thank you for registering with pianocourse101! At pianocourse101, your child can now learn how to play the piano right from the comfort of your own home! \n\nOur lessons are based from the Bastien Piano Basics series because it is both fun and educational for your child. \n\nHowever, you must activate your Premium membership Level 1 monthly account by clicking on the link below: \n\n http://localhost/loginsystem/includes/activatepremium.php?email=",htmlspecialchars($mailTo),"&activatetoken=",htmlspecialchars($token);
mail($mailTo, $subject, $txt, $headers);
我有一个逗号解析错误。
答案 0 :(得分:0)
$headers = "From: ".htmlspecialchars($company);
您应该用点替换逗号。
逗号用于枚举参数,指向concat字符串。