文本插入表格Cell,可点击的URL链接?

时间:2016-07-12 10:47:27

标签: php html mysql

文本是否已插入表格Cell,可点击的URL链接?

我有一个表,它包含三个值FROM,MESSAGE,DATE-TIME

消息单元格采用以下格式

 echo '<table class="table table-fixed  table-bordered table-hover">';

 echo "<tr><th>From</th><th>Message</th><th>Time-Date</th></tr><tr>"; 

 echo $row['message'];

 echo "</td><td>";    

如下所示,我已将单元格FROM设为可点击链接

echo "<tr><td>"; 
echo "<a href=message.php?id=".$senerid.">Reply to : </a>";
echo $row['username']; // username of sender
echo "</td><td>";

这允许视图的用户点击链接,但是我希望链接是可点击的,作为消息的一部分发送,如下例所示

enter image description here

我将消息作为对朋友请求的自动回复发送

$link = "http://accept.php";
echo '<a href="' . $link . '">Accept</a>';

$message = "you have a new friend request  ".$link." Accept"  ;
$sqll = mysqli_query($con,"INSERT INTO `inbox` (`message` , `username` ,   `userid` , `rcpuser`, `senderid`, `time` ) VALUES ('".$message."', '".$_COOKIE[$cookie_name]."', '".$me."','".$q."','".$me."' , now() )");

请问这怎么可能? 提前谢谢。

2 个答案:

答案 0 :(得分:1)

Calendar currentCalendarView = Calendar.getInstance(); Calendar calendar = currentCalendarView; calendar.set(Calendar.DAY_OF_MONTH,currentCalendarView.getActualMinimum(Calendar.DAY_OF_MONTH)); calendarView.setMinDate(calendar.getTimeInMillis()); calendar.set(Calendar.DAY_OF_MONTH, currentCalendarView.getActualMaximum(Calendar.DAY_OF_MONTH)); calendarView.setMaxDate(calendar.getTimeInMillis()); 标记存储在如下变量中,并将该变量附加到消息中,如下所示:

<a>

$clickable_link = '<a href="' . $link . '">Accept</a>'

修改:发送电子邮件时,您可能需要设置标题。

$message = "you have a new friend request  ".$clickable_link;

答案 1 :(得分:1)

您可以使用

转换html链接中的链接
<?php
    header('Content-type: application/json');
    $url=$_POST['resource_url'];
    $json=file_get_contents($url);
    echo $json;
?>

并将其与您的代码一起包含在邮件中。

我还会检查您的链接是否有清除功能,例如$link = '<a href="' . $link . '">Accept</a>'; htmlentities()这会删除或替换带有纯文本的html标记,并阻止链接的“可点击性”之后。

相关问题