About getting the URL of the current script in PHP many friends will say it is simple, but to get a very detailed will have to go through multiple judgments.
$PHP _time = time ();
$PHP _self = isset ($_server[' php_self ')? $_server[' php_self ': (Isset ($_server[' script_name '])? $_server[' Script_name ']: $_server[' orig_path_info ']);
/**
Gets the name of the currently running script: it's a little messy at first. I don't use if else. Look at something like that. We'd better see left from right. It's better to understand. $_server[' script_name '] $_server[' php_self '] $_server[' orig_path_info '] These three server global variables are the names of the current scripts. Mainly look at the current environment of the server. The one that exists, gets that.
The Isset () function is useful. Tests whether a variable is already defined. Note: $a = NULL; Isset ($a) 2881064151 This will return false for OH. Note the use of isset and empty two functions. It's a big problem to use well. Read the manual yourself.
*/
$PHP _querystring = $_server[' query_string ');
$PHP _domain = $_server[' server_name ');
$PHP _referer = isset ($_server[' http_referer ')? $_server[' http_referer ': ';
$PHP _scheme = $_server[' server_port '] = = ' 443 '? ' https://': '/HTTP '; Test whether the server initiates an SSL connection if it is. Use the https://secure connection to pass
$PHP _port = $_server[' server_port '] = = ' 80 '? ': ': '. $_server[' Server_port ';
$PHP _siteurl = $PHP _scheme. $PHP _domain. $PHP _port. Phpcms_path;
$PHP _url = $PHP _scheme. $PHP _domain. $PHP _port. $PHP _self. ($PHP _querystring? ‘?‘. $PHP _querystring: ");
/**
Gets the URL of the current script
*/
PHP gets the URL of the current script case