如何解决php获取不到form数据-PHP问题

资源魔 33 0

若何处理php猎取没有到form数据?

成绩处理 修正php.ini设置装备摆设

找到php.ini设置装备摆设文件,查找enable_post_data_reading变量,修正为关上状态,正文掉句前分好

; Whether PHP will read the POST data.
; This option is enabled by default.
; Most likely, you won't want to disable this option globally. It causes $_POST
; and $_FILES to always be empty; the only way you will be able to read the
; POST data will be through the php://input stream wrapper. This can be useful
; to proxy requests or to process the POST data in a memory efficient fashion.
; http://php.net/enable-post-data-reading
enable_post_data_reading = On    //约莫656行,修正此条

修正设置装备摆设后,发现仍是没有行,持续查阅材料。

猎取非表复数据

收集材料之后,发现vue-axios向后端post的长短表复数据(Ajax没有同),正在猎取非表复数据时需求用php://input

$raw = file_get_contents('php://input');//猎取非表复数据echo $raw;//输入后果
PS:post时前端申请头要设置为
headers: {    "Content-type": "application/json; charset=utf-8"}

相干保举:php教程

以上就是若何处理php猎取没有到form数据的具体内容,更多请存眷资源魔其它相干文章!

标签: php php教程 php故障解决 php使用问题

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