我在另一個php文件中打開「email.php」。 「email.php」會生成一個嵌入超鏈接的隨機代碼,但隨機生成的代碼未被插入。相反,字符串正在發送。功能randomCodeGenerator
的作品,並在util2.php
文件。HTML HREF中的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: "Arial";">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: "Arial";">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>
當我點擊發送給我的電子郵件中的鏈接,該超鏈接看起來是這樣的:
http://corsair.cs.iupui.edu:21221/upload/lab2/validateLab2.php?a=%3C?phpecho%20$code;?%3E
您可以查看源?其他PHP塊是否顯示在那裏?由於某種原因,它似乎並沒有得到執行。 –
[如何在屬性值內添加php標籤?](https://stackoverflow.com/questions/14900370/how-to-add-php-tags-inside-attribute-value) – pvg
@ chris85'email .php'文件與訪問它的文件位於同一個目錄中。我正在使用'file_get_contents()'函數將'email.php'文件的內容打開成一個名爲'$ body'的變量。然後我使用'mail/mail.class.php'庫發送郵件。 – cparks10