Original: pre-defined variables-PHP manual notes
The predefined variables represent all external variables as built-in environment variables, and the error information is represented as a return header. A hyper-global variable is a built-in variable that is always available in all scopes. You can access them without having to do it in a function or method global $variable
.
$GOBALS
All variables available in the global scope are referenced and are always available in PHP.
$_SERVER
Server and execution environment information, this contains more array elements, such as, and $_SERVER[‘PHP_SELFT‘]
$_SERVER[‘SCRIPT_FILENAME‘]
$_SERVER[‘SERVER_NAME‘]
so on. The items in this array are created by the Web server, and there is no guarantee that each server will provide all the items.
$_GET
An array of variables passed to the current script through the URL parameter.
$_POST
An array of variables passed to the current script through the HTTP POST method.
$_FILES
An array of files uploaded to the current script via the HTTP POST method.
$_REQUEST
The default contains $_GET
$_POST
$_COOKIE
arrays of, and. When run as a command line, it will not contain argv
and argc
information that they will exist with the $_SERVER
array. This array of items and their order depends on the configuration of the instructions with PHP variables_order
.
$_SESSION
The current script can use an array of session variables, either by starting a new session session_start()
or by reusing existing sessions.
$_ENV
An array of variables that are passed to the current script through the environment, which are imported into the global namespace of PHP from the runtime environment of the PHP parser.
$_COOKIE
An array of variables passed to the current script via HTTP cookies can be setcookie()
set by a cookie on the client.
$php_errormsg
Contains the most recent error information generated by PHP and is available only in the scope where the error occurred.
$HTTP_RAW_POST_DATA
Contains the original data for the post submission.
$http_response_header
Contains the HTTP response header, how did the experiment succeed in my system?
$argc
Contains the number of parameters that are passed to the current script at the command line, with a minimum value of 1. Available only regiser_argc_argv
when open.
$argv
Contains an array of parameters that are passed to the current script at the command line, and the first parameter is always the file name of the current script.
(End of full text)
Pre-defined variables-PHP manual notes