【发布时间】:2012-03-19 11:15:59
【问题描述】:
可能重复:
Correctly encode characters in a PHP mail form (“I'm” turns to be “I\'m”)
我正在通过 PHP 发送一封电子邮件,并且文本在引号前带有一个斜线:
I'm 变为 I\'m
我的 PHP:
$text_message = $_POST["mymessage"];
$message="--PHP-mixed-$bound_text\r\n"
."Content-Type: text/plain; charset=\"utf-8\"\r\n"
."Content-Transfer-Encoding: 7bit\r\n\r\n"
."$text_message\r\n\r\n"
."--PHP-mixed-$bound_text\r\n"
."Content-Transfer-Encoding: base64\r\n"
."Content-Disposition: attachment; filename=\"$attachment\"\r\n"
."Content-Type: image/jpeg; name=\"$attachment\"\r\n\r\n"
.chunk_split($file)
."\r\n\r\n"
."--PHP-mixed-$bound_text--\r\n\r\n";
}
如何在不收到额外斜杠的情况下发送它? 谢谢。 乌力
【问题讨论】:
-
@AndrewEllis 那么为什么
stripslashes会起作用呢? (我试图引导答案)。如果它确实有效,那么$text_message中的值说明了什么? -
@pst:如果那不是重复的,那就什么都不是。