【发布时间】:2015-05-07 10:50:24
【问题描述】:
我正在尝试在我的 html 电子邮件中插入图像,但是当我尝试引用其 url 时出现错误。我究竟做错了什么?还有另一种方法吗?非常感谢!
<?php
include "config.php";
$email= 'myemail@gmail.com';
$subject = 'Test';
$header= array(
'From: HackHolyokeTeam@hackholyoke.org',
'Content-Type: text/html'
);
$body="
<h1> Title <h1>
<div>
<img src="http://path/to/img/img.jpg">
</div>
<h2> Text 2<h2>
";
mail($email,$subject,$body,implode("\r\n",$header));
echo "email sent!";
?>
【问题讨论】:
-
你用的是双引号,换成单引号path/to/img/img.jpg'>
-
哦,原来如此……谢谢!我总是使用错误的引号..尴尬。