Quantcast
Channel: Bugtreat Blog » url
Viewing all articles
Browse latest Browse all 6

PHP function to get current web page full URL

$
0
0
PHP function to get current web page full URL & current page name. Sometimes, you might want to get the current page full URL. Here is way you can do that. /** * Function for get the full current website page URL * @return string(full url of current website page) */ function fullPageUrl() { $pageURL = (@$_SERVER["HTTPS"] == “on”) ? “https://” : “http://”; if ($_SERVER["SERVER_PORT"] != “80″){ $pageURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } Get current page name. /** * Function for just getting the current website page name * @return string */ function curPageName() { return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],”/”)+1); } Hope these functions will help you, to get more updates like the page Bugtreat Technologies …

Viewing all articles
Browse latest Browse all 6

Trending Articles