The PHPURL address obtains the function code (port, etc.). after reading this code, you can directly use it instead of reading it. Php obtains the current script URL (only Path)
The code is as follows:
Function GetCurUrl ()
{
If (! Empty ($ _
Some SERVER information is often used in PHP programming. the detailed parameters of $ _ SERVER are sorted out for future use. Some SERVER information is often used in PHP programming. the detailed parameters of $ _ SERVER are sorted out for future
$ _ SERVER array element description bitsCN.com
$ _ SERVER array element description
$ _ SERVER ['php _ SELF '] # file name of the script being executed, which is related to document root.
$ _ SERVER ['argv'] # parameters passed to the script.
$ _
Apache originated from the NCSAhttpd server and has been modified many times to become one of the most popular Web server software in the world. Apache is taken from the pronunciation of "a patchy server", which means a server full of patches,
This article introduces the usage of various parameters of $ _ SERVER environment variables. For more information, see this article.
$ _ SERVER ['php _ SELF ']: relative to the path of the website root directory and the PHP program name, it is
In PHP-making projects, it is common to separate the header from the footer. Page header navigation in the selected state will have some style, such as active, when the page in the homepage, the homepage of the navigation should also be the active
SERVER variables $ _ SERVER summary:
$ _ SESSION ['php _ SELF '] -- get the file name of the script being executed.
$ _ SERVER ['server _ Protocol'] -- name and version of the communication PROTOCOL used to request the page. For example, "HTTP/
First, PHP retrieves the URL of the current page:Copy codeThe Code is as follows:// Obtain the current Script URLFunction GetCurUrl (){If (! Empty ($ _ SERVER ["REQUEST_URI"]){$ ScriptName = $ _ SERVER ["REQUEST_URI"];$ Nowurl = $ scriptName;}Else{$
Variable: $ _ SERVER, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_SERVER_VARSVariable: $ _ ENV, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_ENV_VARSVariable: $ _ COOKIE, used in PHP 4.1.0 and
php URL Parts Get methods (global variables), the main introduction of the PHP global variable $_server usage , the need for friends, you can refer to the next.
1, $_session[' php_self ')-Gets the currently executingthe file name of the script2,
Transferred from: http://www.chinaz.com/program/2010/0129/105370.shtml$_server[' php_self '] #当前正在执行脚本的The file name, which is related to document root.$_server[' argv '] #传递给该脚本的参数.$_server[' argc '] #包含传递给The number of command-line arguments for
This article provides a detailed analysis of PHP's methods for obtaining the current url. If you need it, you can refer to it for help.
This article provides a detailed analysis of PHP's methods for obtaining the current url. If you need it, you can
This article provides a detailed analysis of the SERVER variable $ _ SERVER. For more information, see
This article provides a detailed analysis of the SERVER variable $ _ SERVER. For more information, see
In-depth analysis of the SERVER
These are also on the Internet to find hope to help you
$_server[' remote_port '//port. $_server[' server_name '//name of the server host. $_server[' php_self ']//is executing the script's filename $_server[' argv ']//parameters passed to the
The preferred method for php to obtain external variables is to use the hyperglobal variables mentioned below. Prior to this, people were either dependent on register_globals or long pre-defined PHP array ($ HTTP _ * _ VARS ). From PHP5.0.0, PHP
PhpapachePHP_AUTH_USER logon method. The HTTP authentication mechanism of PHP is only valid when PHP runs in the Apache module mode. Therefore, this function is not applicable to CGI versions. In the PHP script of the Apache module, the HTTP
Php pre-defined variable help (with instance ). From php4.1.0, the preferred method for getting external variables is to use the Superglobal variables mentioned below. Prior to this, people were either dependent on register_globals, or long
Php server variable $ _ SERVER introduction. SERVER variable $ _ SERVER Summary: $ _ SESSION [PHP_SELF] -- get the file name of the currently executing script. $ _ SERVER [SERVER_PROTOCOL] -- Name of the communication protocol and SERVER variable on
"Super Global Variables"
A hyper-global variable is an internal variable that can always be used in all scopes. You do not need to perform global $variable in functions or methods, and you can access them.
"$GLOBALS"
References all variables
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.