我的PHP mail()脚本将某些电子邮件客户端(如hotmail)上的!
感叹号更改为%21
当!
位于电子邮件正文的标签中时。
这是我的脚本
$to = "myemail@outlook.com";
$subject = "Password Reset";
$body = "<a href='"http://example.com/#!/page'">Link 1</a>
<br><br>
Without href: http://example.com/#!/page - regular text
";
$headers = "From: no-reply@example.com'r'n";
$headers .= "Reply-To: no-reply@example.com'r'n";
$headers .= "Return-Path: no-reply@example.com'r'n";
$headers .= "X-Mailer: PHP5'n";
$headers .= 'MIME-Version: 1.0' . "'n";
$headers .= 'Content-type: text/html; charset=utf-8' . "'r'n";
mail($to,$subject,$body,$headers);
因此,在上面的脚本中,仅当!
是链接时才更改为%21
,常规文本将其保留为/#!/
而不是将其转换为/#%21/
我将如何解决此问题,使其不会更改为%21
?
某些字符被编码,因为它们不是有效的 URL。在您的情况下,URL 代码点将替换为百分比编码的字节%
。