_php base of Super global variable in PHP

Source: Internet
Author: User
Tags http cookie http post

Super global variables in PHP start with PHP 4.2.0, register_globals default is off, so that many of the previous variables that can be used directly, such as $PHP _self or your set of Session variables cannot be accessed in the form of "$ variable name". This may give you a lot of the same, but it will help you improve your security. To access these variables, you need to use PHP super global variables, as follows:

$_server
Variables are set by the WEB server or are directly associated with the execution environment of the current script. Similar to the old array $HTTP _server_vars array. Previous $php_self correspond to $_server[' php_self ', you can use Phpinfo to view your $_server variables.

$_get
A variable that is submitted to a script via an HTTP get method. Similar to the old array $HTTP _get_vars array.

$_post
A variable that is submitted to the script via the HTTP POST method. Similar to the old array $HTTP _post_vars array.

$_cookie
A variable that is submitted to a script via an HTTP cookie method. Similar to the old array $HTTP _cookie_vars array.

$_session
The variable currently registered to the script session. Similar to the old array $HTTP _session_vars array.

$_files
A variable submitted to the script via an HTTP POST file upload. Similar to the old array $HTTP _post_files array.

$_env
Executes the variables that the environment submits to the script. Similar to the old array $HTTP _env_vars array.

====================================================================
For $_files variables: (File Field field is "MyFile")

$_files[' myfile ' [' Name ']
The original name of the client machine file (including the path).

$_files[' myfile ' [' type ']
The MIME type of the file, which requires the browser to provide support for that information, such as "Image/gif".

$_files[' myfile ' [' Size ']
The size of the uploaded file in bytes.

$_files[' myfile ' [' Tmp_name ']
Temporary file name (including path) stored on the server after the file is uploaded.

$_files[' myfile ' [' Error ']
The error code associated with the file upload. [' ERROR '] is added in PHP version 4.2.0.

When the register_globals in PHP.ini is set to ON, the $myfile _name equivalent to $_files[' myfile ' [' name '], $myfile _type equivalent to $_files[' myfile '] [' Type '], and so on.

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.