php 如何在php中获取完整的引荐网址

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14654686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 07:43:48  来源:igfitidea点击:

How to get full referrer url in php

phphttp-referer

提问by halilenver

I want to get full referrer url in PHP. For instance, if I come to mywebsite from a google search, $_SERVER['REFERER']gives me only www.google.com, but I want smth like www.google.com/search?q=KEYWORD

我想在 PHP 中获取完整的引荐来源网址。例如,如果我从谷歌搜索来到$_SERVER['REFERER']我的网站,只给我 www.google.com,但我想要像 www.google.com/search?q=KEYWORD 这样的东西

Google Analytics provides that for many search engines. I need to get "/search?q=KEYWORD" query string.

谷歌分析为许多搜索引擎提供了这一点。我需要获取“ /search?q=KEYWORD”查询字符串。

回答by thaJeztah

Put this in your script and have a look at it's content;

把它放在你的脚本中,看看它的内容;

<pre>
<?php
var_dump($_SERVER);
?>
</pre>

This way you can find out which keys contain 'what'

这样您就可以找出哪些键包含“什么”