开发者

how do I assign page referrer to a php variable

I am using javascript开发者_Python百科 to get the referring page (document.referrer) which works fine and I can add this value to a div no problem.

How do I assign this value to a PHP variable in order to do some other things with it?

Ideally, something like:

$myphpvariable  = document.referrer;


what about

$myphpvariable = $_SERVER['HTTP_REFERRER'];

?


You can use

$_SERVER['HTTP_REFERER']

and since this is PHP this happens on the server side.

More info: $_SERVER in PHP

As a side note REFERER is sent by the user agent as part of the HTTP request - do not rely on it to be truthful!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜