如何在没有javascript的情况下将值从php传递到简单html?
我试图用php GET Info更新我的HTML a ref标记,但是我似乎无法替换GET值 这是HTML如何在没有javascript的情况下将值从php传递到简单html?,php,html,Php,Html,我试图用php GET Info更新我的HTML a ref标记,但是我似乎无法替换GET值 这是HTML $message = '<h2>Your confirmation link</h2> <p>Click on this <a href="127.0.0.1/ResendVerification.php?passkey=$verification_Code">link</a> to activate your account&l
$message = '<h2>Your confirmation link</h2>
<p>Click on this <a href="127.0.0.1/ResendVerification.php?passkey=$verification_Code">link</a> to activate your account</p>';
$message='您的确认链接
单击此按钮可激活您的帐户”;
我正在尝试用我已经拥有的实际代码替换$verification\u代码,但是出于某种原因,它没有替换任何指导?请查看引号
“
和”
在HTML和PHP之间混合使用引号类型。我建议对PHP使用单引号,对HTML使用双引号。然后,正确的字符串是:
<?php
$message = '<h2>Your confirmation link</h2>
<p>Click on this <a href="127.0.0.1/ResendVerification.php?
passkey=' . $verification_Code . '">link</a> to activate your account</p>';
<?php
$message = "<h2>Your confirmation link</h2>
<p>Click on this <a href=\"127.0.0.1/ResendVerification.php?
passkey=$verification_Code\">link</a> to activate your account</p>";
使用双引号。单引号不计算变量
127.0.0.1
是本地主机-另一台机器无法访问该IP地址,因为它会引用自身。整个字符串都在单引号内,因此PHP变量不会被解析为单引号-您需要从单引号中转义,如
etci仅在这个问题中,它在实际代码中是真正正确的ip OK,但是你需要要么转义单引号,要么用双引号包装整个字符串。我用双引号包装了整个内容,但仍然不起作用。我在电子邮件中得到的HTML不像a href,这是我在电子邮件中得到的[ip/ResendVerification.php?passkey=code]作为一个不可点击的字符串,那些括号是什么?为什么它不能像我的html中显示的那样通过字符串链接“点击”?好的,所以引号是完全正确的,并且正确转义,如我的示例所示?