简体   繁体   中英

REQUEST_METHOD default

Is $_SERVER["REQUEST_METHOD"] set to 'GET' by default?

This code

<?php echo $_SERVER["REQUEST_METHOD"]; ?>

outputs 'GET' even if it is in an empty file with no other tags ( <html> / <form> / <?php ?> )

By default the request sent by browser is always GET . Take a look here

Look at this:

17.3 The FORM element

 <!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form --> <!ATTLIST FORM %attrs; -- %coreattrs, %i18n, %events -- action %URI; #REQUIRED -- server-side form handler -- method (GET|POST) GET -- HTTP method used to submit the form-- enctype %ContentType; "application/x-www-form-urlencoded" accept %ContentTypes; #IMPLIED -- list of MIME types for file upload -- name CDATA #IMPLIED -- name of form for scripting -- onsubmit %Script; #IMPLIED -- the form was submitted -- onreset %Script; #IMPLIED -- the form was reset -- accept-charset %Charsets; #IMPLIED -- list of supported charsets -- > 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM