php file_get_contents("php://input")的用法
来源:互联网 发布:vs for mac 离线 编辑:程序博客网 时间:2024/05/21 05:19
$data = file_get_contents("php://input");
php://input 是个可以访问请求的原始数据的只读流。 POST 请求的情况下,最好使用 php://input 来代替 $HTTP_RAW_POST_DATA,因为它不依赖于特定的 php.ini 指令。 而且,这样的情况下 $HTTP_RAW_POST_DATA 默认没有填充, 比激活 always_populate_raw_post_data 潜在需要更少的内存。 enctype="multipart/form-data" 的时候 php://input 是无效的。
1.php://input 可以读取http entity body中指定长度的值,由Content-Length指定长度,不管是POST方式或者GET方法提交过来的数据。但是,一般GET方法提交数据 时,http request entity body部分都为空。
2.php://input 与$HTTP_RAW_POST_DATA读取的数据是一样的,都只读取Content-Type不为multipart/form-data的数据。
3,Coentent-Type仅在取值为application/x-www-data-urlencoded和multipart/form-data两种情况下,PHP才会将http请求数据包中相应的数据填入全局变量$_POST
4,PHP不能识别的Content-Type类型的时候,会将http请求包中相应的数据填入变量$HTTP_RAW_POST_DATA
5. 只有Coentent-Type为multipart/form-data的时候,PHP不会将http请求数据包中的相应数据填入php://input,否则其它情况都会。填入的长度,由Coentent-Length指定。
6.只有Content-Type为application/x-www-data-urlencoded时,php://input数据才跟$_POST数据相一致。
7.php://input数据总是跟$HTTP_RAW_POST_DATA相同,但是php://input比$HTTP_RAW_POST_DATA更凑效,且不需要特殊设置php.ini
8.PHP会将PATH字段的query_path部分,填入全局变量$_GET。通常情况下,GET方法提交的http请求,body为空。
阅读全文
0 0
- php file_get_contents("php://input")的用法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input")的使用方法
- file_get_contents("php://input", "r")
- 关于file_get_contents("php://input")
- file_get_contents("php://input", "r")
- file_get_contents("php://input")
- file_get_contents("php://input")
- 关于file_get_contents("php://input")
- http与https协议的区别
- Dubbo入门---搭建一个最简单的Demo框架
- jwt的TOKEN
- 【PHP】PHP里针对while循环里的异常退出的处理
- 数据库使用规范
- php file_get_contents("php://input")的用法
- Service
- 互斥锁属性
- 使用 kotlin 开发 android 遇到的问题
- oracle12c及PLSQL Developer安装全程记录
- 乌镇AI论坛最全盘点:中国互联网半壁江山坐在了一起,他们怎么看AI
- Informatica Update 机制详解
- centos redis安装配置整合php
- Nginx shiro redis 多tomcat共享session