Considerations for using PHP4.2.0 and later versions

Source: Internet
Author: User
Tags form post
From the beginning of PHP4.2.0, the default value of the PHP command register_globals is off (in the php. ini configuration file). This is an important change of PHP. What is register_globals used? It is used by PHP to determine whether to convert EGPCS (Environment, GET, POS

From the beginning of PHP 4.2.0, the default value of the PHP command register_globals is off (in the php. ini configuration file). This is an important change of PHP. What is register_globals used? PHP is used to determine whether the EGPCS (Environment, GET, POST, Cookie, Server) variables are registered as global variables.

For example, for a http://www.xx.php? Var = 2 here var. when it is on, you only need to use $ var, but when it is off, you must use $ _ GET ['var'] to receive ~ $ _ GET is an array of PHP Super global variables. Like it, there are:

$ GLOBALS

Contains a reference variable that points to the global category of each current script. The key of the array is the name of the global variable. $ GLOBALS array exists from the beginning of PHP 3.

$ _ SERVER

Variables are set by the Web server or directly associated with the execution environment of the current script. It is equivalent to the old array $ HTTP_SERVER_VARS, but it is not a variable with $ _ SERVER. because PHP processes them differently, the same below. Although $ HTTP_SERVER_VARST and $ HTTP _ * _ VARS below can still be applied, it is not recommended that you apply $ HTTP _ * _ VARS.

$ _ GET

Variables submitted to the script through the http get method. For example, variables generated by GET methods of URLs and forms.
Application method: $ _ GET ['XX']; // that is, $ xx; the same below

$ _ POST

Variables submitted to the script through the http post method. For example, the variable generated by the form POST method.
Application method: $ _ POST ['XX'];

$ _ COOKIE

Variables submitted to the script through HTTP Cookies. For example, when reading the COOKIE value.

$ _ FILES

Variables submitted to the script after being uploaded through the http post file. In my other article, the usage of the file upload processing process has been described more specifically.

$ _ ENV

Variables submitted to the script in the fulfillment environment.

$ _ REQUEST

Variables submitted to the script by any user input mechanism, including GET, POST, COOKIE, and other methods, are not trustworthy.

$ _ SESSION

An array that stores SESSION variables.

You do not need to use session_regisger to register a variable. the above process is included in $ _ SESSION ['XX.

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.