我如何使这个电子邮件我的引用URL


How do I make this email me the referring URL

我有非常非常非常基本的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');
    ?>

$_SERVER['HTTP_REFERER']添加到邮件内容中

$message = "Client has viewed the page with referer " . preg_replace('_'s_m', '', $_SERVER['HTTP_REFERER']);

preg_replace部分是为了安全起见,它将去掉所有的空格(无论如何都不应该在URL中)