$ _SERVER ['HTTP_REFERER']丢失

我想$_SERVER['HTTP_REFERER']在我的网站上使用,但得到以下信息:

Notice: Undefined index: HTTP_REFERER

我试过打印$_SERVER。输出以下内容:

Array

(

[HTTP_HOST] => 192.168.1.10

[HTTP_USER_AGENT] => Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0

[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5

[HTTP_ACCEPT_ENCODING] => gzip, deflate

[HTTP_CONNECTION] => keep-alive

[PATH] => /sbin:/usr/sbin:/bin:/usr/bin

[SERVER_SIGNATURE] => Apache/2.2.3 (CentOS) Server at 192.168.1.10 Port 80

[SERVER_SOFTWARE] => Apache/2.2.3 (CentOS)

[SERVER_NAME] => 192.168.1.10

[SERVER_ADDR] => 192.168.1.10

[SERVER_PORT] => 80

[REMOTE_ADDR] => 192.168.1.77

[DOCUMENT_ROOT] => /var/www/html

[SERVER_ADMIN] => root@localhost

[SCRIPT_FILENAME] => /var/www/html/sandeep/test/hash.php

[REMOTE_PORT] => 53851

[GATEWAY_INTERFACE] => CGI/1.1

[SERVER_PROTOCOL] => HTTP/1.1

[REQUEST_METHOD] => GET

[QUERY_STRING] =>

[REQUEST_URI] => /sandeep/test/hash.php

[SCRIPT_NAME] => /sandeep/test/hash.php

[PHP_SELF] => /sandeep/test/hash.php

[REQUEST_TIME] => 1347365919

)

谁能帮助我找到HTTP_REFERER或建议替代方案HTTP_REFERER

回答:

从文档中:

页面(如果有的话)的地址,该页面将用户代理引至当前页面。这是由用户代理设置的。并非所有的用户代理都将设置此功能,有些用户代理提供了将HTTP_REFERER修改为功能的功能。简而言之,它不能真正被信任。

以上是 $ _SERVER ['HTTP_REFERER']丢失 的全部内容, 来源链接: utcz.com/qa/436212.html

回到顶部