Pre-defined Hyper-global arrays in PHP base-php

Source: Internet
Author: User

Pre-defined arrays:
Automatic Global variables---hyper-global arrays

1. Contains data from the Web server, client, run environment and user input
2. These arrays are more specific
3. The global scope automatically takes effect, you can use these arrays directly
4. Users cannot customize these arrays, but these data operate in the same way as our custom array operations
5. These arrays can be used directly in functions

$_get//The variables submitted to the script via URL request, form default submission method and link submission method

$_post//variables submitted to the script via the HTTP POST method
$_request//Through GET, post and cookie mechanisms to commit variables to the script, so the array is not trustworthy, try not to use

<?PHPEcho $_get["username"]. " <br> "; Echo $_get["Email"]. " <br> "; Echo $_get["Page"]. " <br> "; $_get["Eeee"]= ""; Print_r($_get); Print_r($_post); Print_r($_request);? ><form action= "demo.php" method= "POST" >username: <input type= "text" name= "uname" ><br>Password: <input type= "password" name= "pass" ><br> <input type= "Submit" value= "Login" > &LT;BR&GT;&LT;/FORM&G T;<a href= "Demo.php?username=zhangsan&[email protected]&page=45" >this is a$_getTest</a>


$_files//upload via HTTP POST file to script, file processing chapter, File upload
$_cookie//
$_session//
$_ENV//Execution Environment commit to script variables

 <? php  echo     ' <pre> ' ;  print_r  ($_env      echo  ' </pre> ' ;  echo  $_env  ["OS"]. "    <br> ";  foreach  ($_env  as   $key  => $value   echo   $key ." =".  $value . "    <br> "; }

$_server//variables are set by the Web server or are directly associated with the execution environment of the current script

 <? php  echo     ' <pre> ' ;  print_r  ($_server  );     echo  ' </pre> ' ;  echo  $_server  ["Document_root"]. "    <br> ";  foreach  ($_server  as   $key  => $value  ) { echo   $key ." =".  $value . "    <br> "; } 

$GLOBALS//As long as the current script is valid variables are here, the array key name is the name of the global variable

Pre-defined Hyper-global arrays in PHP base-php

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.