Considerations for using PHP4.2.0 and later versions

Source: Internet
Author: User
Tags file upload http cookie http post variables versions

From the beginning of the PHP 4.2.0 version, the default value for the PHP directive register_globals is off (in the php.ini configuration file). This is a major change in PHP. What is register_globals for? It is used by PHP to control whether EGPCS (environment, GET, POST, Cookie, Server) variables are registered as global variables.

For example, for http://www.xx.php?var=2 var here, when on, you only need to use the $var, but at off, you must use $_get["var"] to receive the ~ Here's $_get is a PHP super global variable array. And it has the same nature:

$GLOBALS

Contains a reference to a variable in the global scope that is valid for each current script. The key of the array is the name of the global variable. $GLOBALS array is present starting with PHP 3.

$_server

Variables are set by the WEB server or are directly associated with the execution environment of the current script. Equivalent to the old array $HTTP _server_vars array, but and $_server is not a variable because PHP handles them differently, the same below. Although $http_server_varst and the following $http_*_vars are still available, it is never recommended that you use $http_*_vars again.

$_get

A variable that is submitted to a script via an HTTP get method. For example, a variable that is generated by a URL, a form's Get method.
Use way: $_get["XX"]; namely $xx; Same

$_post

A variable that is submitted to the script via the HTTP POST method. For example, a variable that is generated by the form's post method.
Use way: $_post["XX"];

$_cookie

A variable that is submitted to a script via an HTTP cookie method. For example, when reading a cookie value.

$_files

A variable submitted to the script via an HTTP POST file upload. My other article's further explanation of the file upload process is a more detailed description of its usage, which is no longer explained here.

$_env

Executes the variables that the environment submits to the script.

$_request

A variable that is submitted to a script through any user input mechanism, including Get,post,cookie, so the array is not trustworthy.

$_session

An array that holds the session variables.

You do not have to use Session_regisger to register a variable, and use the $_session["XX" to include the above process.



Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.