想在php变量中使用href

时间:2014-04-12 18:17:03

标签: php html email

我需要发送一封验证邮件,工作正常。但我不想在电子邮件中显示“链接”,我只需要显示一些文字,如“点击此处验证”

{
$verify_email="
Hello,
Thank you for signup.
For verify e-mail go to this http://".$site_url."/verify.php?user=%s&key=%s;
Or enter your verify code on verification page. Code is: %s
Thanks you.
";
}

这会发送如下所示的电子邮件

您好, 感谢您的注册。 要验证电子邮件,请转到此http://testsite.com/verify.php?user=username&key=de94569d40077060f5f5eb;

但我需要这个

您好, 感谢您的注册。 要验证电子邮件,请单击此处

请帮帮我

3 个答案:

答案 0 :(得分:1)

{
$verify_email="
Hello,
Thank you for signup.
For verify e-mail <a href='http://".$site_url."/verify.php?user=%s&key=%s> go to this </a>
Or enter your verify code on verification page. Code is: %s
Thanks you.
";
}

这是常规的HTML标记。使用锚标记并将您的URL括在href属性中。

答案 1 :(得分:0)

使用此代码

<?php
$to  = 'your recipients';
$subject = 'Your subject';
$message = 'Your html code';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers);
?>

答案 2 :(得分:0)

试试这个

$verify_email='
Hello,
Thank you for signup.
For verify e-mail go to this <a href="http://'.$site_url.'/verify.php?user=%s&key=%s">Click here</a>
Or enter your verify code on verification page. Code is: %s Thanks you.';