首页 > 解决方案 > 如何在 PHP 中的此文本字符串中获取可点击链接

问题描述

我试图从 PHP 发送一封带有下一个正文的电子邮件:

$message .= 'This is a simple message';
$message .= "\n";
$message .= 'http://www.yahoo.com';
$message .= "\n";
$message .= "<a href='https://www.google.com'>Google</a>";
$message .= "\n";

结果我得到了下一个输出:

This is a simple message    //This line is ok
http://www.yahoo.com        //This line is ok
<a href='https://www.google.com'>Google</a> //It should appear the word Google clickable but it does not

我没有使用带有可点击到Google网站的链接的 Google一词,而是获得了 html 代码,我该如何解决这个问题?谢谢

标签: phptextclickable

解决方案


我不确定,没有尝试过,但也许可以尝试:

$message .= '<a href="https://www.google.com">Google</a>';

注意:在 href 链接中添加了双引号


推荐阅读