$ _ SERVER [ 'HTTP_REFERER'] [英] $_SERVER['HTTP_REFERER']

查看:155
本文介绍了$ _ SERVER [ 'HTTP_REFERER']的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上发布了一个报告问题链接,我希望它在发送给我的最后一个地址,然后点击报告链接。我知道/认为你使用$ _SERVER ['HTTP_REFERER'],但我不知道如何把它放在邮件代码中?那么你怎么写这里是我的邮件代码。

I am making a report problem link on my website and I want it to email me the last address they were on before clicking on the report link. I know/think you use $_SERVER['HTTP_REFERER'] but I dont know how to put that in the mail code?So how would you write that here is my mail code with out it.

Mail("email@email.com", "Subject", "Message");
echo "Report Sent";


推荐答案

消息应该是一个可以放置信息的变量in:

The message should be a variable that you can put information in:

$message = "Error report: <p>Last site visited: {$_SERVER['HTTP_REFERER']}</p>....";

mail("email@email.com", "Subject", $message);

请注意, HTTP_REFERER 位置于{}在字符串中。这就是强制它推断值(我不喜欢字符串连接)。

Note that the HTTP_REFERER bit is placed within {} in the string. That's to force it to extrapolate the value (I don't like string concatenation).

另请注意,如上所述,不保证REFERER将有正确的价值,或任何价值。

Also note that, as has been said above, there's no guarantee that the REFERER will have the right value, or any value at all.

这篇关于$ _ SERVER [ 'HTTP_REFERER']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆