I want the the url of the page from which a request has been made. How can I do that in PHP?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The refer(r)er can be found in the $_SERVER
global variable. Please note that sending the refer(r)er is completely optional and a user-agent can simply decide to not send the refer(r)ing url.
$_SERVER['HTTP_REFERER']
回答2:
$_SERVER['HTTP_REFERER']
The documentations are available here here.