PHP Super Global Variables Summary
Summary of silicon1985 's important PHP Super global variables
PHP has 9 predefined array of variables, summarized as follows:
1, $_server
The $_server Super global variable contains information created by the Web server that provides information about the server and client configuration and the current request environment. Depending on the server, the variable value and the number of variables in the $_server are different, but the variables defined in the CGI1.1 specification can generally be found. These include:
$_server[' Http_referer ']; The URL of the page that guides the user to the current location;
$_server[' REMOTE_ADDR ']; Customer IP address;
$_server[' Request_uri ']; The path portion of the URL. If the URL is [Url]http://www.example.com/blog/apache/index.html[/url], then the URI is/blog/apache/index.html.
$_server[' Http_user_agent ']; The customer's user agent generally provides information about the operating system and the browser.
2, $_get
The $_get Super global variable contains information about parameters passed using the Get method. If the request URL is [Url]http://www.example.com/index.html?cat=apache&id=157[/url], you can use the $_get Super global variable to access the following variables:
$_get[' cat '] = "Apache";
$_get[' id '] = "157";
By default, the $_get Super global variable is the only way to access the variables passed by the pass get method.
3, $_post
The $_post Super global variable contains information about the parameters passed by the Post method.
With script subscribe.php, you can use the following post variables:
$_post[' email '] = "jason@example.com";
$_post[' pswd '] = "rainyday";
$_post[' subscribe '] = "subscribe!";
As with $_get, by default, the $_post Super global variable is the only way to access the post variable.
4, $_cookie
The $_cookie Super global variable stores information passed to the script via an HTTP cookie. These cookies are generally set by PHP functions Setcookie (), which were previously executed by PHP scripts. For example, suppose you use Setcookie () to store a cookie named example.com with a value of ab2213. This value can then be obtained by calling $_cookie[' example.com '].
5, $_files
The $_files Super global variable contains information about the data that is uploaded to the server via the Post method. This super global variable differs from the other variables, which is a two-dimensional array that contains 5 elements. The first subscript indicates the file upload element name of the form; The second subscript is one of five predefined subscripts that describe a property of the uploaded file:
$_files[' upload-name ' [' name ']; File name for uploading files from client to server;
$_files[' upload-name ' [' type ']; The MIME type of the uploaded file, whether or not the variable is assigned depends on the browser's functionality.
$_files[' upload-name ' [' Size ']; The size (in bytes) of the uploaded file;
$_files[' upload-name ' [' tmp_name ']; After uploading, move this file to the temporary name given before the final location.
$_files[' upload-name ' [' Error ']; Upload status code. Although the variable is named error, it is actually filled in the case of success. It has five possible values:
UPLOAD_ERR_OK File successfully uploaded
The upload_err_ini_size file size exceeds the maximum value specified by the upload_max_filesize directive.
The upload_err_form_size file size exceeds the maximum value specified by the Max_file_size hidden form field parameter (optional).
Upload_err_partial file only part of the upload
Upload_err_no_file file not specified in upload form
6, $_env
The $_ENV Super global variable provides information about the server environment in which php resolves. The variables in this array include:
$_env[' HOSTNAME ' host name of server
$_env[' shell '] system shell
7, $_request
The $_request Super global variable is a versatile player that records variables passed to the script in various ways, especially get, POST, and COOKIE. The order of these variables does not depend on the order in which they appear in the sending script, but rather depends on the order specified by the Variables_order configuration directives. It is recommended to use this super variable sparingly because it is not secure enough.
8, $_session
The $_session Super global variable contains information about all sessions. Registering session information provides you with the convenience of referencing these session information throughout the site without the need to pass data through a GET or post display.
9. $GLOBALS
The $GLOBALS Super global variable array can be thought of as a superset of the super global variables, including all variables within the global scope. Execute the following code to see all the variables in the $globals.
print '
' ; Print_r ($GLOBALS);
' ;
http://www.bkjia.com/PHPjc/917114.html www.bkjia.com true http://www.bkjia.com/PHPjc/917114.html techarticle PHP Super Global variables summary silicon1985 important PHP Super Global variables summary PHP has 9 predefined array of variables, summarized as follows: 1, $_server $_server Super global variable contains by ...