簡體   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