$_POST and php://input

to sum up:

  1. When the Content-Type of the HTTP POST request is application/x-www-form-urlencoded: php://input is the original data similar to a=1&b=2. $_POST is an associative array (regular post form submission, ajax default post submission)
  2. When submitting the form. php://input is invalid when enctype="multipart/form-data"
  3. $_POST cannot get the post data when Content-Type = "text/plain", php://input can
  4. In addition: basically $GLOBALS['HTTP_RAW_POST_DATA'] and $_POST are the same. But if the post data is not recognized by PHP, you can use $GLOBALS['HTTP_RAW_POST_DATA'] or $HTTP_RAW_POST_DATA to receive it, such as text/xml or soap.

Guess you like

Origin blog.csdn.net/weixin_38230961/article/details/103157230