码迷,mamicode.com
首页 > Web开发 > 详细

php 获取不到post的值

时间:2019-06-14 21:24:54      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:获取   nts   code   put   cat   ati   头信息   contents   出现   

一般在ajax提交的时候出现这种情况

当我们在ajax参数设置   contentType: ‘application/json; charset=utf-8‘, 用file_get_contents("php://input")获取值 $_POST是获取不到的

1.检查头信息content-type是不是为“content-type:application/x-www-form-urlencoded" 这种传输是以表单的方式提交数据php使用$_POST方式接受。

2.如果头信息content-type是不是为“content-type:application/json"这种传输是以json方式提交数据,php需要使用file_get_contents("php://input")获取输入流的方式接受

php 获取不到post的值

标签:获取   nts   code   put   cat   ati   头信息   contents   出现   

原文地址:https://www.cnblogs.com/lichihua/p/11025396.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!