Answers for "php get url of current page on localhost"

PHP
2

php current page url

$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
$host     = $_SERVER['HTTP_HOST'];
$script   = $_SERVER['SCRIPT_NAME'];
$params   = $_SERVER['QUERY_STRING'];
 
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
 
echo $currentUrl;
Posted by: Guest on December-17-2020

Code answers related to "php get url of current page on localhost"

Browse Popular Code Answers by Language