Home > Backend Development > PHP Tutorial > Analysis of the difference between php $_POST and php://input_PHP tutorial

Analysis of the difference between php $_POST and php://input_PHP tutorial

WBOY
Release: 2016-07-20 11:09:50
Original
942 people have browsed it

$_POST and php tutorial://input can get the value, $HTTP_RAW_POST_DATA is empty
$_POST organizes the submitted data in an associative array, and encodes it, such as urldecode, and even encoding conversion

php://input can also implement this function to obtain the original data of POST.

Code
echo file_get_contents( "php://input ");

Instance





post.php


php://input allows reading 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 with enctype="multipart/form-data".


php $_POST

The $_POST variable is an array containing the variable names and values ​​sent by the HTTP POST method.

The $_POST variable is used to collect values ​​from the form with method="post". Information sent from a form with the POST method is invisible to anyone (it does not appear in the browser's address bar), and there is no limit on the amount of information sent.

html


Enter your name:
Enter your age:

welcome.php

Welcome .

You are years old!

Variables sent via HTTP POST will not appear in the URL.
No length limit for variables


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444770.htmlTechArticle$_POST and php tutorial://input can get the value, $HTTP_RAW_POST_DATA is empty$_POST in associative array mode Organize the submitted data and encode it, such as urldecode, or even encode...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template