电子邮件中 =1 的编码
我可能有一个愚蠢的问题。在脚本中,我生成带有 GET 参数的 URL,例如“www.mydomain.com/index.php?item=1234”。该 URL 将由 PHP 通过 mail() 以 UTF-8 编码发送(脚本文件本身也是 utf-8)。现在,每次我在“=”后面有两个数字的 GET 参数时,电子邮件中的 URL 看起来像“www.mydomain.com/index.php?item□34”,带有一个矩形而不是“=12”。我确信有一个简单的方法可以解决这个问题?
预先感谢,
梅尼
I have probably a stupid problem. In a script I generate a URL with GET parameters, something like 'www.mydomain.com/index.php?item=1234'. This URL will be sent by PHP through mail() in an UTF-8 encoding (the scriptfile itself also is utf-8). Now each time I have the GET-Parameter with two numbers after the '=' the URL in the email looks like 'www.mydomain.com/index.php?item□34' with a rectangle instead of '=12'. I am sure there is an easy way to fix this?
Thanks in advance,
Maenny
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 quoted-printable 编码,其中编码序列以
= 开头
。与其费力地手动编码,不如选择一个可以为您完成此操作(以及更多功能)的邮件库。我推荐 PHPmailer。另外,url 参数也很难看。通过 Apache mod_rewrite 模块可以很容易地设置漂亮的 url使用像
www.mydomain.com/item/1234
这样的 URL,它具有独立于实现并且对 SEO 更友好的额外好处。 (要获得完整的 SEO 友好性,请使用www.mydomain.com/item/my-cool-item
或至少www.mydomain.com/item/1234/my-cool-item
代码>.)You must be using quoted-printable encoding in which encoding sequences start with
=
. Instead of struggling with encoding manually, choose a mail library which does that (and a lot more) for you. I recommend PHPmailer.Also, url parameters are ugly. It is very easy to set nice urls via the Apache mod_rewrite module and use urls like
www.mydomain.com/item/1234
, which has the added benefit of being implementation-independent and somewhat more SEO-friendly. (For full SEO-friendliness usewww.mydomain.com/item/my-cool-item
or at leastwww.mydomain.com/item/1234/my-cool-item
.)