开发者

source of REQUEST

开发者 https://www.devze.com 2023-01-23 17:21 出处:网络
How do I get the url from which the request was submitted. I tried $_SERVER[\'REQUEST_URI\']; but this gives me the d开发者_C百科estination url not the source url. Is it possible to get the origin?You

How do I get the url from which the request was submitted. I tried $_SERVER['REQUEST_URI']; but this gives me the d开发者_C百科estination url not the source url. Is it possible to get the origin?


You are looking for $_SERVER['HTTP_REFERER'];

Note:

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.


$_SERVER['HTTP_REFERER'] will work, if it is provided by the calling browser. Note that it is provided by the client so it may be empty or faked, so don't trust it security-wise.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号