Skip to content

Instantly share code, notes, and snippets.

@amdrade
Created September 29, 2017 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrade/0a650c2868f161f383658d14de95f75f to your computer and use it in GitHub Desktop.
Save amdrade/0a650c2868f161f383658d14de95f75f to your computer and use it in GitHub Desktop.
Funções PHP
function generateUrl() {
$protocol = $_SERVER['SERVER_PORT'] == '443' ? 'https' : 'http';
$uri = $_SERVER['REQUEST_URI'];
$Url = $protocol.'://'.str_replace('//', '/', $_SERVER['SERVER_NAME'].'/'.$uri);
return $Url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment