$HTTP_RAW_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).

也就是说,基本上$GLOBALS['HTTP_RAW_POST_DATA'] 和 $_POST是一样的。但是如果post过来的数据不是PHP能够识别的,你可以用 $GLOBALS['HTTP_RAW_POST_DATA']来接收,比如 text/xml 或者 soap 等等。

PHP默认识别的数据类型是application/x-www.form-urlencoded标准的数据类型

用Content-Type=text/xml 类型,提交一个xml文档内容给了php server,要怎么获得这个POST数据。

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).

由于PHP默认只识别application/x-www.form-urlencoded标准的数据类型,因此,对型如text/xml的内容无法解析为$_POST数组,故保留原型,交给$GLOBALS['HTTP_RAW_POST_DATA'] 来接收。

另外还有一项 php://input 也可以实现此这个功能

php://input 允许读取 POST 的原始数据。和 $HTTP_RAW_POST_DATA 比起来,它给内存带来的压力较小,并且不需要任何特殊的 php.ini 设置。php://input 不能用于 enctype="multipart/form-data"。

应用

a.htm   
  ------------------   
  <form   action="post.php"   method="post">   
      <input   type="text"   name="user">   
      <input   type="password"   name="password">   
      <input   type="submit">   
  </form>      
    
  post.php   
  ----------------------------   
  <?   echo   file_get_contents("php://input");   ?>   

转载保留链接

最新文章

  1. VTK初学一,比较常见的错误2
  2. HTML5编码规范
  3. web应用程序开发原理
  4. 九、Android学习第八天——广播机制与WIFI网络操作(转)
  5. 《BI项目笔记》创建时间维度(2)
  6. c#基础知识-2
  7. svn 切换默认用户名
  8. 域名的a记录转过来他的公网ip
  9. Base-Android快速开发框架(一)--概述
  10. Composite 组合模式
  11. qutIm编译
  12. Xamarin 使用极光推送 详细教程
  13. 使用Python的Mock库进行PySpark单元测试
  14. react context跨组件传递信息
  15. 产品设计利器--axure
  16. cmd 命令 添加端口
  17. jQuery动态设置样式(style、css)
  18. iOS 11开发教程(二十)iOS11应用视图美化按钮之设置按钮的状态
  19. 力扣(LeetCode)125. 验证回文串
  20. 深入理解Java反射+动态代理

热门文章

  1. oracle rownum(转)
  2. vue教程3-webpack搭建项目
  3. css布局全总结
  4. ES6新特性使用小结(三)
  5. ICPC-无限路之城(数学+思维)
  6. bzoj1822: [JSOI2010]Frozen Nova 冷冻波网络流
  7. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D
  8. python 3 学习字符串和编码
  9. 基于 opencv图像去噪
  10. JAVA基础之Map接口