Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php结果中将电子邮件显示为超链接_Php_Hyperlink - Fatal编程技术网

如何在php结果中将电子邮件显示为超链接

如何在php结果中将电子邮件显示为超链接,php,hyperlink,Php,Hyperlink,我有一个数据库,当查询与数据库中的任何内容都不匹配时,我试图将我的电子邮件地址显示为超链接。我正在使用下面的 PHP代码… else{ // if there is no matching rows do following echo "<br /><br /><br /><strong><h2>"."You have searched a term that is not in the database. Please co

我有一个数据库,当查询与数据库中的任何内容都不匹配时,我试图将我的电子邮件地址显示为超链接。我正在使用下面的

PHP代码…

else{ // if there is no matching rows do following

    echo "<br /><br /><br /><strong><h2>"."You have searched a term that is not in the database. Please contact <a href=\"mailto:email@domain.com" . htmlentities($_POST['email@domain.com']) . "\">".htmlentities($_POST['email@domain.com']) . "</a>, if you think this term should be added."."</h2></strong>";
else{//如果没有匹配的行,请执行以下操作
echo“


”您搜索了一个不在数据库中的术语。如果您认为应该添加此术语,请与联系。“”;
但是,我得到的结果是这样的…

“您搜索的术语不在数据库中。如果您认为应该添加此术语,请与联系。”

除了超链接的电子邮件地址,所有的东西都在那里


想法?

$\u POST['email@domain.com“]
可能未定义(或为空)


难道你不想:
“email@domain.com“

$\u POST['email@domain.com“]
可能未定义(或为空)

难道你不想:
“email@domain.com“

此:

$_POST['email@domain.com']
应改为:

$_POST['email'];
其中电子邮件是您的表单字段。只有当您从上一页获取电子邮件地址的值作为表单字段时,此操作才有效。如果不是这样,则只需替换$\u POST['email@domain.com“]与”email@domain.com“;

这:

$_POST['email@domain.com']
应改为:

$_POST['email'];
其中电子邮件是您的表单字段。只有当您从上一页获取电子邮件地址的值作为表单字段时,此操作才有效。如果不是这样,则只需替换$\u POST['email@domain.com“]与”email@domain.com“;


尽管如此,您可能希望提供一些电子邮件地址模糊处理机制。这将为您的用户提供一定程度的保护,防止垃圾邮件机器人挖掘您的电子邮件地址。通常,未受保护的地址(如上例所示)会随着时间的推移收到越来越多的垃圾邮件

如果您正在显示它们的页面在登录后得到保护,那么问题就小得多。


尽管如此,您可能希望提供一些电子邮件地址模糊处理机制。这将为您的用户提供一定程度的保护,防止垃圾邮件机器人挖掘您的电子邮件地址。通常,未受保护的地址(如上例所示)会随着时间的推移收到越来越多的垃圾邮件

如果您正在显示它们的页面在登录后得到保护,那么问题就小得多。

试试这个

else{ // if there is no matching rows do following
    $mail = htmlentities('email@domain.com');
    echo "<br /><br /><br /><strong><h2>" .
        "You have searched a term that is not in the database. Please contact <a href=\"mailto:$mail\">$mail</a>, if you think this term should be added.</h2></strong>";
else{//如果没有匹配的行,请执行以下操作
$mail=htmlentities('email@domain.com');
回声“



”。 “您搜索的术语不在数据库中。如果您认为应该添加此术语,请与联系。”;
试试这个

else{ // if there is no matching rows do following
    $mail = htmlentities('email@domain.com');
    echo "<br /><br /><br /><strong><h2>" .
        "You have searched a term that is not in the database. Please contact <a href=\"mailto:$mail\">$mail</a>, if you think this term should be added.</h2></strong>";
else{//如果没有匹配的行,请执行以下操作
$mail=htmlentities('email@domain.com');
回声“



”。 “您搜索的术语不在数据库中。如果您认为应该添加此术语,请与联系。”;
$\u POST['email@domain.com“]
应该是
$\u POST['email']
。不应该是
email@domain.com
mailto
之后。您的声明应如下所示:

 echo "<br /><br /><br /><strong><h2>"."You have searched a term that is not in the database. Please contact <a href='mailto:" . htmlentities($_POST['email']) . "'>".htmlentities($_POST['email']) . "</a>, if you think this term should be added."."</h2></strong>";
echo“


”您搜索了一个不在数据库中的术语。如果您认为应该添加此术语,请与联系。“”;
$\u POST['email@domain.com“]
应该是
$\u POST['email']
。不应该是
email@domain.com
mailto
之后。您的声明应如下所示:

 echo "<br /><br /><br /><strong><h2>"."You have searched a term that is not in the database. Please contact <a href='mailto:" . htmlentities($_POST['email']) . "'>".htmlentities($_POST['email']) . "</a>, if you think this term should be added."."</h2></strong>";
echo“


”您搜索了一个不在数据库中的术语。如果您认为应该添加此术语,请与联系。“”;
Done。结果仍然为空。我在哪里添加电子邮件文本?执行以下操作:echo“”;print_r($\u POST);echo“”;以确保$\u POST中包含您想要的内容。结果仍然为空。我在哪里添加电子邮件文本?执行以下操作:echo“”;print_r($\u POST);echo“”;为了确保$\u POST中包含您想要的内容,您的解决方案运行良好。为什么要删除
$\u POST[]
?为什么要添加$\u POST?如果邮件地址没有随表单一起发送(这对我来说没有多大意义),您不必使用$\u POST您的解决方案运行良好。为什么要删除
$\u POST[]
但是?为什么要添加$\u POST?如果邮件地址没有与表单一起发送(这对我来说没有多大意义…),您不必使用$\u POST此网站将位于广告服务器的内部。谢谢。此网站将位于广告服务器的内部。谢谢。