Php function code for getting website addresses
-
/**
- * Obtain the complete website address.
- * By bbs.it-home.org
- */
- Function getRootUrl (){
- $ Name = '';
- If (isset ($ _ SERVER ['http _ host']) {
- $ Name = $ _ SERVER ['http _ host'];
- } Else {
- $ Name = $ _ SERVER ['server _ name'];
- }
- If (strpos ($ name, ':') ===false & $ _ SERVER ['server _ port']! = 80 ){
- $ Name. = ':'. $ _ SERVER ['server _ port'];
- }
- $ Path = $ _ SERVER ['php _ SELF '];
- $ Path = substr ($ path, 0, strrpos ($ path, '/') + 1 );
-
Return 'http: // '. $ name. $ path;
- }
>>> Extended reading: PHP obtains visitors' IP addresses in two ways. PHP obtains MAC addresses. implementation code: php obtains the final address of a youku video. example of php obtaining a real IP address: PHP: How to Get domain name and domain name IP address php: how to get the redirected URL address instance code php: how to get the client IP address php: how to get the computer MAC address example php: how to hide the real instance code of the file php obtains the local Lan (intranet) IP address code and function description: six methods to obtain the IP address of the php Client php code to obtain the real IP address of the User php code to achieve IP address and digit interchange php code to obtain the Nic MAC address and URL in the main domain code php: php code used to determine whether the IP address is a domestic IP address or a foreign IP address. php code used to obtain the client IP address, geographical information, browser information, and local real IP address. php code used to capture the email address on the webpage. php code used to record the visitor's IP address. default http string method for URL address php verification email address function php obtains client IP address four methods use php to get user IPv4 or IPv6 address code |