Answers for "php code to echo current website url"

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
0

current page link using php

$url=$_SERVER['REQUEST_URI'];
echo $url;
Posted by: Guest on December-24-2021

Browse Popular Code Answers by Language