Differences between $_get ($HTTP _get_vars) and $_post ($HTTP _post_vars)

Source: Internet
Author: User

$HTTP _get_vars and $_get $HTTP _post_vars and $_post

$HTTP _post_vars can be used in versions 3.0 and below, $HTTP _post_vars is not an automatic global variable

$_post can only be used in versions 4.0 and above

For your code application can be more extensive, please write $http_post_vars


HTTP POST Variable: $_post
Note: Used in PHP 4.1.0 and later versions. Previous versions, using the $HTTP _post_vars.

An array of variables that are passed through the HTTP POST method. is an automatic global variable.

This is a "superglobal", or can be described as an automatic global variable. This simply means that it works in all scripts. You do not need to use the global $_post in a function or method; To access it, just as with $HTTP _post_vars.

$HTTP _post_vars contains the same information, but not an automatic global variable. (Note: Http_post_vars and $_post are different variables, and PHP handles them in different ways.) )
in version php5.x, the default PHP setting is to disallow the use of Http_post_vars variables, so that some programs that were originally run in version php4.x will appear notice:undefined variable:http_post_vars Such a mistake, only need to modify the php.ini file in the Register_long_arrays, the default is off, change it to on on it!

HTTP POST Variable: $_post
Note: Used in PHP 4.1.0 and later versions. Previous versions, using the $HTTP _post_vars. Of course, the general is PHP5 now, generally do not use this kind of writing
If you want to be compatible with PHP4, refer to Discuz source code

-------------------------------------------------------------------------------

-------------------------------------------------------------------------------

HTTP GET Variable: $_get
Note: used in PHP 4.1.0 and later versions. Previous versions, using   $HTTP _get_vars.  
An array of variables passed by the HTTP GET method. is an automatic global variable.  
This is a "superglobal", or it can be described as an automatic global variable. This simply means that it works in all scripts. You do not need to use global $_get in a function or method; To access it, just as with $HTTP _get_vars.  
$HTTP _get_vars contains the same information, but not an automatic global variable (note: $HTTP _get_vars and $_get are different variables, PHP handles them differently).  
If the register_globals directive is set, these variables are also available in all scripts, that is, the $_get and $HTTP _get_vars arrays are separated. For related information, please refer to the section on security using Register Globals. These individual global variables are not automatic global variables. &NBSP



HTTP POST variable: $_post
Note: used in PHP 4.1.0 and later versions. Previous versions, using   $HTTP _post_vars.  
An array of variables passed by the HTTP POST method. is an automatic global variable.  
This is a "superglobal", or it can be described as an automatic global variable. This simply means that it works in all scripts. You do not need to use global $_post in a function or method; To access it, just as with $HTTP _post_vars.  
$HTTP _post_vars contains the same information, but not an automatic global variable (note: $HTTP _post_vars and $_post are different variables, PHP handles them differently).  
If the register_globals directive is set, these variables are also available in all scripts, that is, the $_post and $HTTP _post_vars arrays are separated. For related information, please refer to the section on security using Register Globals. These individual global variables are not automatic global variables

Practical application: When the form is very large, it is possible to pass the value in the form of an array, and then cooperate with some classes to manipulate it.

viewing situation: Print_r ($_post);

Differences between $_get ($HTTP _get_vars) and $_post ($HTTP _post_vars)

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.