This article summarizes the predefined array variables. With predefined array variables, we can obtain information such as the system environment, user dialogs, and form data.
1. SERVER variable: $ _ SERVER
Use the foreach statement to print all elements in $ _ SERVER:
<? ( => .' => '..'<br>' ?>
2. environment variable: $ _ ENV(No output results)
3. GET variable: $ _ GET
<Form action = "<? ['Php _ SELF ']?> "Method =" GET "> name: <input type =" text "name =" name "size =" 15 "/> age: <input type = "text" name = "age" size = "15"/> Hobbies: <input type = "text" name = "Hober" size = "15"/> <input type = "submit" name = "submit" value = "submit"/> </ form> <? (['Submit ''<p>'' name :'. ['name']. '<br> ''age :'. ['age']. '<br> ''Hobbies :'. ['hobby']. '<br>'?>
4. POST variable: $ _ POST
When data is transmitted through POST, the data is not displayed in the URL, so it is safer than GET. Furthermore, there is no theoretical limit on the amount of data transmitted in POST mode.
<Form action = "<? ['Php _ SELF ']?> "Method =" POST "> name: <input type =" text "name =" name "size =" 15 "/> age: <input type = "text" name = "age" size = "15"/> Hobbies: <input type = "text" name = "Hober" size = "15"/> <input type = "submit" name = "submit" value = "submit"/> </ form> <? (['Submit ''<p>'' name :'. ['name']. '<br> ''age :'. ['age']. '<br> ''Hobbies :'. ['hobby']. '<br>'?>
5. File Upload variable: $ _ FILES(The Error Code indicates that the file cannot be found)
<Form enctype = "multipart/form-data" action = "<? = ['Php _ SELF ']?> "Method =" POST "> <input type =" hidden "name =" MAX_FILE_SIZE "value =" 104857600 "/> <! -- 100 M --> upload a file: <input name = "upload_file" type = "file" size = "50"/> <input type = "submit" name = "submit" value = "Upload"/> </ form> <? (['Submit '['uplaod _ file'] ['error'] = UPLOAD_ERR_ OK? 'Upload successful! <Br> ':' Upload Failed! <Br> ''upload file name :'. ['upload _ file'] ['name']. '<br> ''size of the uploaded file :'. ['upload _ file'] ['SIZE']. 'byte <br> ''temporary file name :'. ['upload _ file'] ['tmp _ name']. '<br>'?>