Copy CodeThe code is as follows: function Getsiteurl ()
{
Global $_sconfig;
if (Empty ($_sconfig[' Siteallurl '))
{
$uri = $_server[' Request_uri ']?$_server[' Request_uri ']:($_server[' php_self ']?$_server[' php_self ']:$_SERVER[' Script_name ']);
Return Shtmlspecialchars (' http://' $_server[' Http_host '].substr ($uri, 0, Strrpos ($uri, '/') +1));
}
Else
{
Return $_sconfig[' Siteallurl '];
}
}
Global $_sconfig; Defines a global variable $_sconfig ($_sconfig is actually a tuple of VAR, defined in common.php)
if (Empty ($_sconfig[' siteallurl '))//Determine if the $_sconfig[' Siteallurl '] variable is empty
$uri = $_server[' Request_uri ']?$_server[' Request_uri ']:($_server[' php_self ']?$_server[' php_self ']:$_SERVER[' Script_name ']);
$_server[' Request_uri '];$_server[' php_self '];$_server[' Script_name '] after three mesh operation, give the result to the
$_server is also an array, you can print it and know what to do with it. Only three array elements are involved here
$_server[' Request_uri ']; Request_uri:/mysite/-> Site Directory?
$_server[' php_self ']; Php_self:/mysite/index.php-> the file name of the script that is currently executing
$_server[' Script_name ']; Script_name:/mysite/index.php-> contains the path of the current script
http://www.bkjia.com/PHPjc/320518.html www.bkjia.com true http://www.bkjia.com/PHPjc/320518.html techarticle Copy the code as follows: function Getsiteurl () {global $_sconfig; if (Empty ($_sconfig[' Siteallurl ')) {$uri = $_server[' Request_ur I ']?$_server[' Request_uri ']:($_server[' php_self ...