我之前没有使用过 $_SERVER['HTTP_REFERER']
,我不知道如何使用它来通过点击 Google 搜索结果中的链接来找到访问我网站的用户.用户可以来自 google.com、google.co.uk 等......
I haven't used $_SERVER['HTTP_REFERER']
before and i dont knw how i can use that to find that user came to my site by clicking on a link in Google search results. User can come from google.com, google.co.uk etc....
非常感谢帮助.
$url = $_SERVER['HTTP_REFERER'];
$query = parse_url ($url, PHP_URL_QUERY);
$host = parse_url ($url, PHP_URL_HOST);
if (strstr ($query, 'q=') && strstr ($host, 'google.')) {
// user came from google
else {
// user didnt come from google
}
这篇关于我如何使用 $_SERVER['HTTP_REFERER'] 来查找来自 google 的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!