douhezi2285 2014-09-28 18:26
浏览 39
已采纳

在PHP中使用mail()函数放置链接? [关闭]

This is just a general formatting question. I'm attempting to place a link in the e-mail function, but I'm having trouble placing a period at the end of the link without having it become part of the link. I've tried concatenating a period at the end of it, but after the e-mail is sent it becomes part of the link.

"http://google.com" . ".";

Would I need to use html to do this? Specifically <a href="">.</a>

EDIT: Additional information:

$txt = "Please follow this link to the form: '<a href="http://google.com"></a>.';"

I put the rest of the code on the same line on a new line, but it still doesn't seem to register properly.

  • 写回答

2条回答 默认 最新

  • drzyeetvt41077335 2014-09-28 18:31
    关注
    <?php
        echo '<a href="http://google.com">Google</a>.';
    

    the period belongs outside of the <a> tag. Anything inside the <a> tag will be part of the link

    Update: OP has updated the question.

    You basically had a single quote where you didn't need one and you weren't escaping your double quotes. I prefer to use single quotes in my strings so I don't have to escape double quotes, and it's cleaner to read.

    $txt = 'Please follow this link to the form: <a href="http://google.com">Google</a>.';
    

    or, if you prefer using double quotes, you have to escape them because your string is enclosed in double quotes.

    $txt = "Please follow this link to the form: <a href=\"http://google.com\">Google</a>.";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题