php的HTTP_RAW_POST_DATA
用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"。