HTML HREF中的PHP不起作用

时间:2017-09-14 19:05:15

标签: php html

我在另一个php文件中打开“email.php”。 “email.php”生成一个嵌套到超链接中的随机代码,但是没有插入随机生成的代码。相反,正在发送文字字符串。函数Goods有效,位于randomCodeGenerator文件中。

util2.php

当我点击发送到我的电子邮件的链接时,超链接如下所示:

<?php
   require_once "inc/util2.php";

   ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head></head>
   <body>
      <?php
         $code = randomCodeGenerator(50);
         ?>
      <p style="color: black;font-weight: bold;text-align: center;font-family: &quot;Arial&quot;;">Hello! Thank you for your interest in Space Proposition! 
         For your account to become activated, please lease click the following link below to activate your email account:<br>
      </p>

      <a href="http://corsair.cs.iupui.edu:21221/upload/lab2/validateLab2.php?a=<?php echo $code;?>">
         <p style="font-weight: bold;text-align: center;font-family: Arial;">Click Me!</p>
      </a>

      <br />
      <p style="color: black;font-weight: bold;text-align: center;font-family: &quot;Arial&quot;;">Once again, thank you very much for your interest. We will 
         do our best to keep the website updated regulary as new discoveries are made!<br>
      </p>
   </body>
</html>

2 个答案:

答案 0 :(得分:0)

尝试改变添加代码的方式,例如:

$code = randomCodeGenerator(50);
$url = "http://corsair.cs.iupui.edu:21221/upload/lab2/validateLab2.php?a=".$code;

最后;

<a href='<?php echo $url;?'>

答案 1 :(得分:0)

file_get_contents只是拉取文件的内容并将其存储到变量中。绕过PHP处理器,使用Web服务器处理文件,然后您将获得结果。 e.g。

file_get_contents('http://yourscript.php');

而不是:

file_get_contents('/local/yourscript.php');