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!
精彩评论