【发布时间】:2010-01-28 17:54:10
【问题描述】:
我有一个非常奇怪的问题。我正在使用 PHP,在我的 PHP 代码中,我编写了电子邮件内容并生成了这个链接:
....
<a href="http://www.domain.com/act.php?id=' . $userid . '&key=' . $actkey . '">http://www.domain.com/act.php?id=' . $userid . '&key=' . $actkey . '</a>
....
大多数时候,它工作正常。然后,我收到很多投诉说他们无法激活。在检查了他们的电子邮件后,我发现了这个:
<a href="http://www.domain.com/act.php?id=20090=hsdf87hsf89sd">http://www.domain.com/act.php?id=20090=hsdf87hsf89sd'</a>
缺少“&键”。为什么?很奇怪的bug!!!
完整的 PHP 命令:
$content = '<div style="font-family:Calibri; color:#333;">
Hi there, <br><br>
Thank you for register to our website, click the following link to activate your account:<br><br>
<a href="http://www.domain.com/act.php?id=' . $userid . '&key=' . $actkey . '">http://www.domain.com/act.php?id=' . $userid . '&key=' . $actkey . '</a><br><br>
XXX Team</div>';
Gumbo 可能是对的,我的电子邮件内容是基于 HTML 的:
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
【问题讨论】:
-
我认为您有引用问题。您可以发布导致该字符串的完整 PHP 命令吗?
-
编辑您的问题,并发布您如何生成链接
-
+1 欢迎来到 StackOverflow,@PHPNoob1001。
-
@Pekka:我检查了我的报价,看起来不错。奇怪的是,为什么大部分时间都很好。太奇怪了@Pentium10:我编辑了我的问题,请再看看@Jon:谢谢。我喜欢这个网站。响应速度非常快。太棒了!!!