[英]How to find out what was the referral url?
People come to my website from variety of other websites and I would like to know these referral urls? 人们从其他各种网站访问我的网站,我想知道这些引荐网址吗? How can I do it in PHP?
如何在PHP中做到这一点?
You can get the referrer using $_SERVER['HTTP_REFERER']
. 您可以使用
$_SERVER['HTTP_REFERER']
获取引荐来源网址。 Note that it's very easy for the client to spoof this, so don't rely on it for anything important. 请注意,客户很容易欺骗这一点,因此不要依赖它做任何重要的事情。
You can find out about other $_SERVER
variables here . 您可以在此处找到其他
$_SERVER
变量。
$ref = getenv("HTTP_REFERER");
要么
$ref = $_SERVER['HTTP_REFERER'];
Use the system variable: 使用系统变量:
$_SERVER['HTTP_REFERER']
Check this answer for more details. 检查此答案以获取更多详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.