繁体   English   中英

在以下代码中如何使用htmlspecialchars:

[英]how to use htmlspecialchars in the following code:

有人告诉我,输出到屏幕时必须使用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);

我有一个逗号解析错误。

$headers = "From: ".htmlspecialchars($company);

您应该用点替换逗号。
逗号用于枚举参数,指向连接字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM