好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php获取不到post怎么办

php获取不到post的解决办法:首先检查头信息“content-type”;然后使用“file_get_contents("php://input")”获取输入流的方式接收post数据即可。

php 获取不到post的值

一般在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中文网!

以上就是php获取不到post怎么办的详细内容!

查看更多关于php获取不到post怎么办的详细内容...

  阅读:38次