Some server information is often used in php programming. I paste the commonly used information in highlighted mode, and the rest will be placed behind it for future reference.
The code is as follows:
$ _ SERVER ['http _ ACCEPT_LANGUAGE '] //
Php variable usage method variable: $ _ SERVER, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_SERVER_VARS
Variable: $ _ ENV, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_ENV_VARS
Variable: $ _
This article introduces the usage of various parameters of $ _ SERVER environment variables. For more information, see this article. $ _ SERVER [#39; PHP_SELF #39;]: relative to the path of the website root directory and PH... this article
$ _ SERVER and php_server in PHP. $ _ SERVER usage instructions in PHP. some SERVER information is often used in PHP programming. the detailed parameters of $ _ SERVER are sorted out for future use. $ _ PHP $ _ SERVER and php_server
Some SERVER
$expression false if ($expressiontrueiftrueelse:? >otherwise this'll show. Data type:Boolean true/false is case insensitiveIntegerFloatStringArrayObjectResourceNullecho//PrintVar_dump ()//view the value and type of an expressionGetType ()Is_string ()
There are several ways to get URL address bar parameters:$_server["Server_port"]//get port$_server[' Http_host ']//get the domain name or host address such as www.sina.com or music.sina.com$_server[' server_name ']//get the domain name or host
In PHP, the $ _ SERVER variable sorts out the current url :. $ _ SERVER [HTTP_HOST]. $ _ SERVER [PHP_SELF]; $ _ SERVER variable summary $ _ SERVER [QUERY_STRING] query string. $ _ SERVER [DOCUMENT_ROOT] $ _ SERVER variable sorting in PHP currently
The port used by the server. The default value is "80 ". If you use an SSL secure connection, this value is the HTTP port you set.
For example, I need to obtain the current URL address.
$ Url_this = "http: //". $ _ SERVER ['http _ host']. $ _ SERVER
PHP server Variable $_server detailed
Server variable $_server Detailed:1, $_session[' php_self ')--Gets the file name of the currently executing script2, $_server[' Server_protocol ')--the name and version of the communication protocol when the
For details about $ _ SERVER parameters and descriptions in PHP, read the detailed parameters and descriptions of $ _ SERVER in PHP. some SERVER information is often used in php programming, special to the $ _ SERVER detailed parameters, convenient
Cross-Site trace (XST) Cross-Site tracking ***
vulnerability description XST *** is a method for collecting user information using server debugging trace ***, because the TRACE method causes the server to return the content sent by the
PHP gets the current script URL (only path)
Copy CodeThe code is as follows:
function Getcururl ()
{
if (!empty ($_server["Request_uri"))
{
$scrtName = $_server["Request_uri"];
$nowurl = $scrtName;
}
Else
{
$scrtName = $_server["Php_self"];
if
PHP Hyper-Global variables
$GLOBALSContains a reference to a globally valid variable that refers to each current script. The array's key is labeled as the name of the global variable. $GLOBALS array exists starting with PHP 3.
$_serverVariables are
发起http请求后 network会显示各类加载的资源,php有什么办法获取某一type的name size等信息吗?
Is it possible to use the Curl Head protocol?
Reply content:
发起http请求后 network会显示各类加载的资源,php有什么办法获取某一type的name size等信息吗?
Is it possible to use the Curl Head protocol?
PHP obtains the path, name, and server path of the file running before the current period. & lt ;? Phpecho displays the relative path and file name of the script file :. $ _ SERVER [PHP_SELF]. & lt; br & gt; echo display the CGI script
$ _ SERVER [& amp; 39; PHP_SELF & amp; 39;] file name of the script being executed, which is related to documentroot. $ _ SERVER [& amp; 39; argv & amp; 39;] parameters passed to the script. $ _ SERVER [& amp; 39; argc & amp; 39;] include the
$_server instructions for use in PHP, php_server instructions for use
PHP programming often need to use some of the server's information, special $_server detailed parameters to organize, convenient for later use.
$_server[' php_self ')
$ _ SERVER [& amp; #39; PHP_SELF & amp; #39;] # file name of the script being executed, which is related to documentroot. $ _ SERVER [& amp; #39; argv & amp; #39;] # parameters passed to the script. $ _ SERVER [& amp; #39; argc & amp; #39;] #
$_server[' php_self ') #当前正在执行脚本的文件名, related to document root.
$_server[' argv '] #传递给该脚本的参数.
$_server[' argc '] #包含传递给程序的命令行参数的个数 (if run in command-line mode).
$_server[' Gateway_interface ') #服务器使用的 the version of the CGI specification. For
PHP programming often need to use some of the server's information, special $_server detailed parameters to organize, convenient for later use.Summarized as follows:$_server[' php_self '] #当前正在执行脚本的The file name, which is related to document
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.