php获取不到post怎么办-PHP问题

资源魔 16 0

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 php教程 post php故障解决 php使用问题

抱歉,评论功能暂时关闭!