1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > javascript – 用js自写ajax提交表单数据到php 但是php的$_POST为空?

javascript – 用js自写ajax提交表单数据到php 但是php的$_POST为空?

时间:2022-10-06 23:18:28

相关推荐

javascript – 用js自写ajax提交表单数据到php 但是php的$_POST为空?

后端开发|php教程

php,javascript,ajax,post

后端开发-php教程

有价t5源码,vscode管理已有插件,ubuntu换语言,tomcat应用版本发布,c#链接sqlite字符串,网页爬虫与大数据分析是啥课,php统计访客,名优seo优化哪家好,刷网站pv软件,phpcms 模板变量lzw

iocp acceptex 源码,vscode状态栏颜色更改,ubuntu连iphone,tomcat 服务端口,有道网络爬虫,广州php平均工资,杭州seo服务外包亲测有效,拍拍网站源码lzw

如图,这是接收表单数据的php控制器,有Form Data数据传进去了,但是php的$_REQUEST中只有$_GET的数据,没有$_POST的数据,这是为什么?(应该不用看代码吧?如需看代码,说一下,我再补上去)

微信房卡麻将 源码,用vscode安装哪些插件,ubuntu 该名称,tomcat新增访问端口,房里有爬虫,php 创建图片并保存,福州有效的seo服务电话,网站统计插件,免费wap模板lzw

//这是上图的文本版Remote Address:127.0.0.1:80Request URL:http://localhost/app/index.php?c=member&a=submit&random=0.122100246604532Request Method:undefinedStatus Code:200 OKRequest HeadersAccept:*/*Accept-Encoding:gzip, deflate, sdchAccept-Language:zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4,fr;q=0.2Connection:keep-aliveContent-Length:42Content-type:application/x-www-form-urlencodedCookie:cityId=18; CNZZDATA1252926391=1013903247-1419300217-%7C1421816418; PHPSESSID=3fltaetqosqt69uqj9hd8imr77Host:localhostOrigin:http://localhostReferer:http://localhost/app/index.php?c=makeFactory&a=getVideoFileUser-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4Query String Parametersc:membera:submitrandom:0.122100246604532Form Dataview sourcecontent:0video_id:908price:0label_id:11Response HeadersCache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0Connection:Keep-AliveContent-Length:80Content-Type:text/htmlDate:Sun, 01 Mar 02:50:07 GMTExpires:Thu, 19 Nov 1981 08:52:00 GMTKeep-Alive:timeout=5, max=100Pragma:no-cacheServer:Apache/2.2.17 (Win32) PHP/5.3.3X-Powered-By:PHP/5.3.3

回复内容:

如图,这是接收表单数据的php控制器,有Form Data数据传进去了,但是php的$_REQUEST中只有$_GET的数据,没有$_POST的数据,这是为什么?(应该不用看代码吧?如需看代码,说一下,我再补上去)

//这是上图的文本版Remote Address:127.0.0.1:80Request URL:http://localhost/app/index.php?c=member&a=submit&random=0.122100246604532Request Method:undefinedStatus Code:200 OKRequest HeadersAccept:*/*Accept-Encoding:gzip, deflate, sdchAccept-Language:zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4,fr;q=0.2Connection:keep-aliveContent-Length:42Content-type:application/x-www-form-urlencodedCookie:cityId=18; CNZZDATA1252926391=1013903247-1419300217-%7C1421816418; PHPSESSID=3fltaetqosqt69uqj9hd8imr77Host:localhostOrigin:http://localhostReferer:http://localhost/app/index.php?c=makeFactory&a=getVideoFileUser-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4Query String Parametersc:membera:submitrandom:0.122100246604532Form Dataview sourcecontent:0video_id:908price:0label_id:11Response HeadersCache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0Connection:Keep-AliveContent-Length:80Content-Type:text/htmlDate:Sun, 01 Mar 02:50:07 GMTExpires:Thu, 19 Nov 1981 08:52:00 GMTKeep-Alive:timeout=5, max=100Pragma:no-cacheServer:Apache/2.2.17 (Win32) PHP/5.3.3X-Powered-By:PHP/5.3.3

注意到你的Request Method是Undefined,这个地方应该是POST。

你可以:

1、把AJAX提交的方式设置为post

2、最好把表单的method设为post,method=”post”

$_POST可以得到数据嘛?还是放上控制器的代码吧

待补充。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。