Last active
December 14, 2018 12:51
-
-
Save oleteacher/899f07149ef573a82e5effb229c9d2ba to your computer and use it in GitHub Desktop.
Function to get full server URL to directory
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 url_part(){ | |
$http=isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; | |
$part=rtrim($_SERVER['SCRIPT_NAME'],basename($_SERVER['SCRIPT_NAME'])); | |
$domain=$_SERVER['SERVER_NAME']; | |
return "$http"."$domain"."$part"; | |
} | |
?> | |
<?php echo url_part(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment