我对PHP有非常非常基本的知识,我需要以下代码,通过电子邮件发送给每个人访问我的页面,并在电子邮件的消息中包含将用户放在该页面上的引用URL。这就对了。我已经尝试了一些我在stackoverflow上读到的东西,但我无法做到。
谢谢!
<?php
// The message
$message = "Client has viewed the page";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail('myemail@mydomain.com', 'Client 126 Viewed Biz Landing', $message);
// Redirect
header('Location: http://dazogo.com');
?>
答案 0 :(得分:0)
将$_SERVER['HTTP_REFERER']
添加到电子邮件的内容中。
$message = "Client has viewed the page with referer " . preg_replace('_\s_m', '', $_SERVER['HTTP_REFERER']);
preg_replace
部分是为了安全起见,它将剥离所有空格(无论如何都不应该在URL中)。