php中$_POST与php://input的区别实例分析,_post实例分析
本文实例分析了php中$_POST与php://input的区别。分享给大家供大家参考。具体分析如下:
$_POST 与 php教程://input可以取到值,$HTTP_RAW_POST_DATA 为空
$_POST 以关联数组方式组织提交的数据,并对此进行编码处理,如urldecode,甚至编码转换
php://input 也可以实现此这个功能可以获得POST的原始数据。
代码
复制代码 代码如下:
echo file_get_contents( "php://input ");
实例
复制代码 代码如下:
post.php
复制代码 代码如下:
php://input 允许读取 POST 的原始数据。和 $HTTP_RAW_POST_DATA 比起来,它给内存带来的压力较小,并且不需要任何特殊的 php.ini 设置。php://input 不能用于 enctype="multipart/form-data"。
php的$_POST:
$_POST 变量是一个数组,内容是由 HTTP POST 方法发送的变量名称和值.
$_POST 变量用于收集来自 method="post" 的表单中的值,从带有 POST 方法的表单发送的信息,对任何人都是不可见的(不会显示在浏览器的地址栏),并且对发送信息的量也没有限制.
html
复制代码 代码如下:
welcome.php
复制代码 代码如下:
Welcome .
You are years old!
通过 HTTP POST 发送的变量不会显示在 URL 中,变量没有长度限制.
希望本文所述对大家的php程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version