This post explains how to get the current page url using simple php code. Check the below function will generate the current page URL.
1 2 3 4 5 6 7 8 9 10 11 12 13 | function currentPageURL() { $curpageURL = "http"; if ($_SERVER["HTTPS"] == "on") {$curpageURL.= "s";} $curpageURL.= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $curpageURL.= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $curpageURL.= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $curpageURL; } echo currentPageURL(); |








The code was really helpful to me. And it is easy to get the URL name. Thanks for the code.
Its done!!and most thing i understand the code easily..
thanks.
Nice
It is very usefull for me
Thanks
Nice.
$_SERVER is really very useful global array. Get too much more info with var_dump($_SERVER);