变量没有得到它的值

Variable is not getting its value

我正在通过 PHP 邮件程序发送电子邮件以验证帐户,它正在发送并正常工作。但是在$mail->body部分有一个错误,因为我将$name变量传递给<a>标签,但是当我点击我收到的邮件时,它仍然是$name。它应该是我的表单的发布名称,但它只显示 $name 文本,而没有获取 $name 的值。我认为问题出在这一行(语法问题)。

<?php
$name=$_POST['name'];
$mail->isHTML(true);

$mail->Body = '<b>Hello,this is just account activation process please click</b><a href="http://localhost/email_verification/register.php?nm=$name">Here</a><b> and you will be good to go.</b>';
?>

请在 Body 方法中使用双引号。

$mail->Body    = "<b>Hello,this is just account activation process please click</b><a href=\"http://localhost/email_verification/register.php?nm=".$name."\">Here</a><b> and you will be good to go.</b>";