Php 函数的作用是:去掉主题上的特殊字符

Php 函数的作用是:去掉主题上的特殊字符,php,email,special-characters,Php,Email,Special Characters,这是我的代码: $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $msg = "1'2 ’3"4 “5”6 7~8!9@10#11$12%13^14&15*16(17)18}19{20"21:22?23>24<25 "; $subject = "1'2 ’3"4 “5”6 7~8!9@10#11$

这是我的代码:

    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    $msg = "1'2 ’3"4 “5”6 7~8!9@10#11$12%13^14&15*16(17)18}19{20"21:22?23>24<25 ";
    $subject = "1'2 ’3"4 “5”6 7~8!9@10#11$12%13^14&15*16(17)18}19{20"21:22?23>24<25;
    mail("myemail@example.com",$subject,$msg);
$headers=“MIME版本:1.0\r\n”;
$headers.=“内容类型:text/html;字符集=ISO-8859-1\r\n”;

$msg=“1'2'3”4“5”6 7~8!9@10#11$12%13^14&15*16(17)18}19{20“21:22?23>24尝试避开双引号:

"1'2 ’3\"4 \“5\”6 7~8!9@10#11$12%13^14&15*16(17)18}19{20\"21:22?23>24<25 ";

1'2'3\'4\'5\'67~8!9@10#11$12%13^14&15*16(17)18}19{20\"21:22?23>24我考虑过这个问题,但它来自数据库?您需要做的就是将数据库的输出传递到调用
str\u replace
,并将其输出用作主题。如果您不想执行ao str\u replace,也可以尝试
addslashes