$ _SERVER ['HTTP_REFERER']丢失 [英] $_SERVER['HTTP_REFERER'] missing
问题描述
我想在我的网站中使用$_SERVER['HTTP_REFERER']
,但我得到以下信息:
I want to use $_SERVER['HTTP_REFERER']
in my site but i get the following:
Notice: Undefined index: HTTP_REFERER
我尝试打印$_SERVER
.输出以下内容:
I have tried printing $_SERVER
. This outputs the following:
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
的替代方法吗?
Can anyone help me to find HTTP_REFERER
or suggest an alternative to HTTP_REFERER
?
推荐答案
来自文档:
将用户代理引至 当前页面.这是由用户代理设置的.并非所有用户代理都会 进行设置,并且某些功能可以将HTTP_REFERER修改为 特征.简而言之,它不能真正被信任.
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
http://php.net/manual/en/reserved.variables. server.php
这篇关于$ _SERVER ['HTTP_REFERER']丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!