Introduction: Gets the URL path of the current request and automatically determines the protocol (HTTP or HTTPS).
A word of the matter, below directly on the HD without MSK of the subtle code!
function function
Gets the page path (URL) address of the current request
Syntax:$url = getpageurl()
return Result:
string-Request URL
/** * get the current page address * * @author DO.ORG.CN#AC*/functionGetpageurl () {$pageURL= ' http '; if($_server["HTTPS"] = = "on") { $pageURL. = "S"; } $pageURL.= "://"; 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;}
Description: Support for the request protocol, only HTTP and HTTPS support, if more complex identification is required, you can add it yourself .
Conclusion
Combined with previous lecture <[php Learning Tutorial-Network]002.$_server["Script_name", $_server["Php_self"], $_server["query_string"], $_server[" Request_uri "] Introduction ($_server URL infomation) > To learn together, the effect is better.
Not finished, waiting to be updated ...
This site article is for baby bus SD. Team Original, reproduced must be clearly noted: (the author's official website: Baby bus )
Reprinted from "Baby bus Superdo Team" original link: http://www.cnblogs.com/superdo/p/4822702.html
[PHP Learning Tutorial-Network]003. Get the page URL for the current visit (present Request URL)