最新消息: 新版网站上线了!!!

php接收POST数据

方法一:$_POST 

方法二:$GLOBALS["HTTP_RAW_POST_DATA"]; 不支持 enctype="mulitipart/form-data" 可用于text/xml,soap等;

方法三:php://input 不支持 enctype="multipart/form-data" 允许读取POST原始数据,比$GLOBALS["HTTP_RAW_POST_DATA"]带来的内存压力小;

 

$_POST与$GLOBALS["HTTP_RAW_POST_DATA"]功能基本一样,除了在接收不能被PHP识别的数据(如:text/xml,soap等); 

 

php默认识别数据类型:application/x-www-form-urlencoded标准的数据类型;对形如 text/xml的内容无法解析为$_POST数组;此时即可用$GLOBALS["HTTP_RAW_POST_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");   ?> 

转载请注明:谷谷点程序 » php接收POST数据