Created
August 10, 2017 07:19
-
-
Save titomus/ef1e6fcd4ead7b88c445f5673eae605f to your computer and use it in GitHub Desktop.
Récupérer la racine du referer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function racine_referer() | |
{ | |
if (!isset($_SERVER['HTTP_REFERER'])){ | |
return false; | |
}else{ | |
$parser_url = parse_url(trim($_SERVER['HTTP_REFERER'])); | |
return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2))); | |
} | |
} | |
//utilisation | |
echo racine_referer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment