当前位置:网站首页>学习路之PHP--post获取不到请求数据
学习路之PHP--post获取不到请求数据
2022-07-16 14:33:00 【游戏编程】
使用 $_POST['email'] 死活获取不到请求数据。
$parm=file_get_contents("php://input");//可以获取到请求头Content-Type: application/json
var_dump($parm);
var_dump($_POST['email']);//请求头Content-Type: application/x-www-form-urlencoded
var_dump($_POST['password']);//请求头Content-Type: application/x-www-form-urlencoded
官网$_POST说明
当 HTTP POST 请求的 Content-Type 是
application/x-www-form-urlencoded或multipart/form-data时,会将变量以关联数组形式传入当前脚本
解决方法1:在服务器使用
$parm=file_get_contents("php://input");//可以获取到请求头Content-Type: application/json
解决方法2:前端发请求头
method:'POST',
header:{
'Content-Type':'application/x-www-form-urlencoded',
},作者:hopetomorrow
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- C#-线程的加入 进度条加载案例,第一次视频效果的加入啦
- web开发从入门到精通一(详细)
- fastjson反序列化漏洞区分版本号的方法总结
- 论文翻译解读:learning logic rules for reasoning on knowledge graphs【RNNLogic】
- Leetcode refers to the average value of offer II 041 sliding window [sliding window] the way of leetcode in heroding
- 【C语言进阶】⑨动态内存分配知识总结 超详细
- A game research and development company in Shenzhen installed monitoring for each station. Netizen: it's comparable to imprisonment!
- 1.创建Prism项目
- 《遥远的救世主》遵守客观规律(七)——文化属性
- Collection (properties)
猜你喜欢

WordPress个人博客主题wp-Concise-v1.0

北京华联BHG Mall持续发力,BHG DAY引领城市消费新热潮

ctf-pikachu-RCE

844. 比较含退格的字符串

WordPress personal blog theme wp-reason-v1.0

C#网络应用编程,实验一:WPF练习

MySQL 变量、流程控制与游标

Common network devices and network reference models, as well as common network layer protocols and data communication processes

MySQL超详细安装教程 手把手教你安装MySQL到使用MySQL 最简单的MySQL安装方式,这种方式装,卸载也简单

聊一聊Promise
随机推荐
S7-200SMART案例分析——运动控制编程(二)
特征值和特征向量的求法
fastjson反序列化漏洞区分版本号的方法总结
字节三面终上岸,这份热腾腾的面经,请收好「含免费资料」
WordPress personal blog theme wp-reason-v1.0
pycuda 安装完毕,验证步骤
STL string
HALCON联合C#检测表面缺陷——ROI交互(二)(和图片同步缩放裁剪等功能)
Things to do
【Ucos-III源码分析】——软件定时器
Object serialization stream and deserialization stream
Nature Microbiology | 枯草芽孢杆菌生物膜促进甜瓜生长并抗病
ctf-pikachu-sql
让我们自定义反射系统
[基础服务] [数据库] MySQL 主从复制部署与配置
Halcon and C # detect surface defects - ROI interaction (II) (functions such as synchronous scaling and clipping with pictures)
Flask-响应
【Ucos-III源码分析】——内存管理机制
scrapy-redis分布式爬虫部署
MySQL super detailed installation tutorial will teach you to install Mysql to use the simplest MySQL installation method of MySQL. This method is also simple to install and uninstall