In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail what is the difference between $GLOBALS ['HTTP_RAW_POST_DATA'] and $_ POST in PHP. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The details are as follows:
$_ POST: an array of variables passed through the HTTP POST method. Is an automatic global variable.
$GLOBALS ['HTTP_RAW_POST_DATA']: always generate a $HTTP_RAW_POST_DATA variable that contains the original POST data. This variable is generated only when data of unrecognized MIME type is encountered. $HTTP_RAW_POST_DATA is not available for enctype= "multipart/form-data" form data.
That means basically $GLOBALS ['HTTP_RAW_POST_DATA'] and $_ POST are the same.
But if the data from post is not recognized by PHP, you can use $GLOBALS ['HTTP_RAW_POST_DATA'] to receive it, such as text/xml or soap, etc.
Note: the data type recognized by PHP by default is the data type of application/x-www.form-urlencoded standard.
This is what the manual says:
Always generate variables that contain raw POST data. Otherwise, this variable is generated only when data of unrecognized MIME type is encountered. However, a better way to access raw POST data is php://input. $HTTP_RAW_POST_DATA is not available for enctype= "multipart/form-data" form data.
Question: $HTTP_RAW_POST_DATA = $_ POST?
According to the manual, the answer should be no.
If not, what is the difference between them?
I know the answer, as follows:
The RAW / uninterpreted HTTP POst information can be accessed with:
$GLOBALS ['HTTP_RAW_POST_DATA']
This is useful in cases where the post Content-Type is not something PHP understands (such as text/xml).
That is, basically $GLOBALS ['HTTP_RAW_POST_DATA'] is the same as $_ POST. But if the data from post is not recognized by PHP, you can use $GLOBALS ['HTTP_RAW_POST_DATA'] to receive it, such as text/xml or soap, etc.
The data type recognized by PHP by default is the data type of application/x-www.form-urlencoded standard.
Use the Content-Type=text/xml type to submit the contents of an xml document to php server, and how to get the POST data.
The RAW / uninterpreted HTTP POST information can be accessed with: $GLOBALS ['HTTP_RAW_POST_DATA'] This is useful in cases where the post Content-Type is not something PHP understands (such as text/xml).
Because PHP only recognizes application/x-www.form-urlencoded standard data types by default, the contents of matching types such as text/xml cannot be parsed into an array of $_ POST, so the prototype is retained and handed over to $GLOBALS ['HTTP_RAW_POST_DATA'] to receive.
There is also a php://input that can also implement this function.
Php://input allows you to read the raw data of POST. It puts less pressure on memory than $HTTP_RAW_POST_DATA and does not require any special php.ini settings. Php://input cannot be used for enctype= "multipart/form-data".
Application:
A.htm:
Post.php:
This is the end of the article on "what's the difference between $GLOBALS ['HTTP_RAW_POST_DATA'] and $_ POST in PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.