Last active
August 29, 2015 14:06
-
-
Save metashock/e6f090b5f7f930eb79fd to your computer and use it in GitHub Desktop.
PHP - Get Request Uri
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
function get_request_uri() { | |
$url = 'http'; | |
if(isset($_SERVER['https']) && $_SERVER['https'] == 'on') { | |
$url .= 's'; | |
} | |
$url .= '://'; | |
$url .= $_SERVER['SERVER_NAME']; | |
if($_SERVER['SERVER_PORT'] !== '81') { | |
$url .= ':' . $_SERVER['SERVER_PORT']; | |
} | |
$url .= $_SERVER['REQUEST_URI']; | |
return $url; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment