douchuitang0642 2013-11-25 21:27
浏览 40
已采纳

PHP邮件链接添加C:,尝试转到本地文件而不是Web浏览器

$noteContent="Contacted from <a href=\'".$data['PageURL']."\' target=\'_blank\'>".$data['PageURL']."</a>";

$headers .= 'Bcc: xxx@gmail.com' . "
";
$headers .= "Reply-To: ".$from."
";
$headers .= "X-Priority: 1
";
$message=$noteContent.'<br /><br />';
$message.="Name: ".$data['first'].' '.$data['last'].'<br />';
$message.="Email: ".$data['email'].'<br />';
$message.="Phone: ".$data['phone'].'<br /><br />';
$message.="<span style='color:#900;font-weight:bold;'>Please call, bla bla bla bla.</span>";
$message=nl2br($message);
mail($mailto, $subject, $message, $headers);

The problem is that I'm sending this through, and it's outputting correctly when you look at it. Looks like a simple link with the pageurl. However, its actually linking to: res://ieframe.dll/syntax.htm#\'http://www.somewebsite.com\'

So it opens up in their browser as a local file. What am I doing wrong here that is causing that to happen?

  • 写回答

1条回答 默认 最新

  • duanguochong0397 2013-11-25 21:31
    关注

    Your string is enclosed with double quotes, so you don't need to escape the single quotes:

    $noteContent="Contacted from <a href=\'" . $data['PageURL'] . "\' ...
    

    Should just be:

    $noteContent="Contacted from <a href='" . $data['PageURL'] . "' ...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看