(3.20) Pre-defined arrays

Source: Internet
Author: User

<?php/* Predefined Arrays: * Auto global variable---Hyper global array * * 1. Contains data from the Web server, client, run environment, and user input * 2. These arrays are very special * 3. The global scope automatically takes effect, all of which can be directly used by the array * 4. Users cannot customize these arrays, but they operate in the same way as array operations that they define themselves * 5. These arrays can be used directly in the function * * $_get//variables submitted to the script via URL request * $_post////The variables submitted to the script via the HTTP POST method * $_ Request//Variable submitted to script via get, post and COOKIE mechanism * $_files//variable submitted to script via HTTP POST method file Upload * $_cookie* $_session* $_env//Execution Environment commit to script variable * $_server//variables are set by the Web server, or directly associated with the execution environment of the current script * $GLOBALS//As long as the current script is valid variables are here, the array's key name is the name of the global script ***///the Super Global array can be called directly inside the function $arr= Array (10,20);//General Array $_get=array (50,90);//Hyper Global Array function demo () {global $arr;//Call global variable to first include Print_r ($arr);p Rint_r ($_get )///Direct call to a hyper-global array without}?><!--********** page value GET request ***************--><?php//directly to the worth variable, Useful when register_global=on in php.ini configuration files. echo $username. " <br> "; Echo $email." <br> "; Echo $page." <br> ";//The most stable method of value echo $_get[" username "]." <br> "; Echo $_get[" email "]." <br> "; Echo $_get[" page "]." <br> ";? ><a href= "demo.php?username=zhangsan&[email protected]&page=45" >this is a $_GET test</a><!--*********** Page pass-through POST 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"/> <br/></form><?phpprint_r ($_get);//cannot receive Print_r ($_post);// In order to receive the use of the ><?php//$_env echo ' <pre> ';p rint_r ($_env), echo ' </pre> ';//Display the current environment//can also be a single traversal? ><? php//uses a $globals super-global array to call the global variable $a=100 within the function, $b =200, $c =300;function Demo () {//Call the global variable directly echo $GLOBALS ["a"]. " <br> "; Echo $GLOABLS [" B "]." <br> "; Echo $GLOABLS [" C "]." <br> ";}?  >

(3.20) (go) predefined arrays

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.