php获取post参数的几种方式
php获取post参数的几种方式
1、$_POST['paramName'] 只能接收Content-Type: application/x-www-form-urlencoded提交的数据
?
2、file_get_contents("php://input") 适用大多数类型的Content-type
php://input 允许读取 POST 的原始数据。和 $HTTP_RAW_POST_DATA 比起来,它给内存带来的压力较小,并且不需要任何特殊的 php.ini 设置。php://input 不能用于 enctype="multipart/form-data"。
?
3、$GLOBALS['HTTP_RAW_POST_DATA']; 总是产生?<input type="text" name="user">
<input type="password" name="password">
<input type="submit">
</form>
post.php
----------------------------
<? echo file_get_contents("php://input"); ?>
?
HTTP请求参考:
http://blog.csdn.net/kfanning/article/details/6062118
?
?