Home  >  Article  >  Backend Development  >  Predefined variables - PHP manual notes

Predefined variables - PHP manual notes

WBOY
WBOYOriginal
2016-08-08 09:28:41970browse

Predefined variables represent all external variables as built-in environment variables, and error information as return headers. Superglobal variables are built-in variables that are always available in all scopes. They can be accessed within a function or method without executing global $variable.

$GOBALS refers to all variables available in the global scope, which are always available in PHP.

$_SERVERServer and execution environment information, this contains more array elements, such as $_SERVER['PHP_SELFT'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['SERVER_NAME'], etc. . The items in this array are created by the web server, and every server is not guaranteed to serve all items.

$_GETAn array of variables passed to the current script via URL parameters.

$_POSTAn array of variables passed to the current script via the HTTP POST method.

$_FILESAn array of files uploaded to the current script via HTTP POST.

$_REQUESTBy default, it contains arrays of $_GET, $_POST and $_COOKIE. When running in command line mode, the argv and argc information will not be included, they will exist in the $_SERVER array. The items of this array and their order depend on the configuration of PHP's variables_order directive.

$_SESSIONThe current script can use the array of SESSION variables to start a new session or reuse an existing session through session_start().

$_ENVAn array of variables passed to the current script through the environment. These variables are imported from the running environment of the PHP parser into the global namespace of PHP.

$_COOKIEAn array of variables passed to the current script through HTTP Cookies. Cookies can be set on the client through setcookie().

$php_errormsgContains the latest error message generated by PHP and is only available in the scope where the error occurred.

$HTTP_RAW_POST_DATAContains the raw data submitted by POST.

$http_response_header contains the HTTP response header. Why was the test not successful in my system?

$argc contains the number of arguments passed to the current script when running from the command line. The minimum value is 1. Only available when regiser_argc_argv is turned on.

$argv contains an array of arguments passed to the current script when running from the command line. The first argument is always the filename of the current script.

(Full text ends)

The above introduces the predefined variables - PHP manual notes, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn