我正在创建一个通讯系统,用于跟踪打开电子邮件时所有类型的信息。使用php图像跟踪技巧在电子邮件中显示图像
我已经开始用它看起来像
<p><img src="http://xxx.com/newsletterInfo.php?newsletter=12&userid=234" width="314" height="20" alt="Cancel Newsletter Subscription"></p>
然后在newsletterInfo.php文件我正在echo'ing的URL图像的图像。
我认为这不是这样做的方式吗?
有人可以请指出我的问题在哪里。
感谢
更新
电子邮件的发送:
$name = stripslashes($fetchquery["name"]);
$email = stripslashes($fetchquery["email"]);
$content = $_POST["maincontent"];
$subject = $_POST["subject"];
$message = "<html><head><title>".$subject."</title></head><body>";
$message .= str_replace('{name}', $name, $content);
$message .= '<p><img src="http://xxx.com/newsletterInfo.php?newsletter='.$id.'" width="314" height="20" alt="Cancel Newsletter Subscription"></p>';
$message .= "</body></html>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Username <[email protected]>' . "\r\n";
// Mail it
mail($email, $subject, $message, $headers);
在信息页面上,我已经做到了这一点:
if(isset($_GET["newsletter"])) {
$query = $pdo->prepare("UPDATE newsletter SET opened=`opened` +1 WHERE id=:id");
$query->execute(array(':id' => $_GET["newsletter"]));
$query_num = $query->rowCount();
if($query_num > 0){
echo 'http://xxx.com/cancel.png';
}
正如你所看到的电子邮件使用ma发送电子报il()函数,然后在那里图像是我把PHP文件的URL,在这个文件要求的变量,如果它设置它然后回声图像URL,然后输入数据到数据库中,所有这些工程100%因为数据库正在更新。
问题是图像坏了。
如果你点击右键,进入newsletterInfo.php网址显示。
我认为这根本不是这样做的方式。
为什么这不是这样做的?有什么问题 ? – vodich
@vodich对不起,我忘了实际上说图像没有显示。我不明白你的意思是“为什么这不是这样做?”谢谢 – Robert
粘贴一些代码,以便我们可以看到代码中的错误 – vodich