如何在我的php邮件脚本上添加striplashes

时间:2014-02-27 05:06:50

标签: php mailer stripslashes

定制我自己的邮件脚本。 php新手在这里请耐心等待。这是代码。我只想在主题和消息上添加striplashes,如果是这样,它也不会删除我用\ r \ n \ r \ n创建的斜杠?

$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
$content="Name: ".$name."\r\n\r\nCompany: ".$company."\r\n\r\n
Subject: ".$subject."\r\n\r\n
Message: ".$message;
mail('opps@gmail.com',$subject,$content,$headers); //mail the message;
$success = "Thank you! You're email has been sent.";
#done;

有人能告诉我在哪里放置条带和主题的条带?谢谢你们!

2 个答案:

答案 0 :(得分:2)

请按照以下代码:

  "Subject: ".stripslashes($subject)."\r\n\r\n
  Message: ".stripslashes($message);

答案 1 :(得分:1)

$email = stripslashes($email);
$name = stripslashes($name);
$company = stripslashes($company);
$subject = stripslashes($subject);
$message = stripslashes($message);

$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
$content="Name: ".$name."\r\n\r\nCompany: ".$company."\r\n\r\n
Subject: ".$subject."\r\n\r\n
Message: ".$message;
mail('opps@gmail.com',$subject,$content,$headers); //mail the message;
$success = "Thank you! You're email has been sent.";
#done;