Answers for "get homepage url in php"

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

php home url

<?php echo get_home_url(); ?>
Posted by: Guest on June-23-2021

Browse Popular Code Answers by Language