html - php文件无法得到POST过来的数据
程序员文章站
2024-02-07 00:00:18
...
php文件无法得到POST过来的数据,通过$_SERVER得到如下
Array
(
[HOSTNAME] => localhost.localdomain
[PATH] => /usr/local/bin:/usr/bin:/bin
[TMP] => /tmp
[TMPDIR] => /tmp
[TEMP] => /tmp
[OSTYPE] =>
[MACHTYPE] =>
[MALLOC_CHECK_] => 2
[USER] => www
[HOME] => /home/www
[FCGI_ROLE] => RESPONDER
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx
[QUERY_STRING] =>
[REQUEST_METHOD] => GET
[CONTENT_TYPE] =>
[CONTENT_LENGTH] =>
[SCRIPT_FILENAME] => /data0/htdocs/www_v2/index/htdocs/index.php
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /tcenter/manage_type/saveunitc/
[DOCUMENT_URI] => /index.php
[DOCUMENT_ROOT] => /data0/htdocs/www_v2/index/htdocs
[SERVER_PROTOCOL] => HTTP/1.1
[REMOTE_ADDR] => 222.130.133.84
[REMOTE_PORT] => 11347
[SERVER_ADDR] => 118.145.8.49
[SERVER_PORT] => 80
[SERVER_NAME] => *.izton.com
[REDIRECT_STATUS] => 200
[HTTP_HOST] => www.izton.com
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
[HTTP_REFERER] => http://www.izton.com/tcenter/manage_type/editunit.do?id=11016502&num=2
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
[HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8
[HTTP_ACCEPT_CHARSET] => GBK,utf-8;q=0.7,*;q=0.3
[HTTP_COOKIE] => PHPSESSID=8bc85489738f33e8909973ab534d7c80; KF360_6971_LIVE=Y; KF360_6971_REFERER=; PHPSESSID=ecb96ff35d7e68bdc14ffcfcd12835dc; KF360_6971_INVITEDTIMES=2; KF360_6971_VISITID=5666977; uname=172474; upass=123456; rem=1; Hm_lvt_b63d9415462f064e5fda5749bda4808f=1369358159; Hm_lpvt_b63d9415462f064e5fda5749bda4808f=1369641967; formhash=03bc8587; VISITORID=5269925
[PHP_SELF] => /index.php
[REQUEST_TIME] => 1369640508
[argv] => Array
(
)
[argc] => 0
)
但是在做项目的时候其他模板post的数据都可以接受,打印其中一个可接受到post数据的$_server
Array
(
[HOSTNAME] => localhost.localdomain
[PATH] => /usr/local/bin:/usr/bin:/bin
[TMP] => /tmp
[TMPDIR] => /tmp
[TEMP] => /tmp
[OSTYPE] =>
[MACHTYPE] =>
[MALLOC_CHECK_] => 2
[USER] => www
[HOME] => /home/www
[FCGI_ROLE] => RESPONDER
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx
[QUERY_STRING] =>
[REQUEST_METHOD] => POST
[CONTENT_TYPE] => application/x-www-form-urlencoded
[CONTENT_LENGTH] => 199
[SCRIPT_FILENAME] => /data0/htdocs/www_v2/index/htdocs/index.php
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /tcenter/manage_type/saveUnit.do
[DOCUMENT_URI] => /index.php
[DOCUMENT_ROOT] => /data0/htdocs/www_v2/index/htdocs
[SERVER_PROTOCOL] => HTTP/1.1
[REMOTE_ADDR] => 222.130.133.84
[REMOTE_PORT] => 10758
[SERVER_ADDR] => 118.145.8.49
[SERVER_PORT] => 80
[SERVER_NAME] => *.izton.com
[REDIRECT_STATUS] => 200
[HTTP_HOST] => www.izton.com
[HTTP_CONNECTION] => keep-alive
[HTTP_CONTENT_LENGTH] => 199
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ORIGIN] => http://www.izton.com
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
[HTTP_CONTENT_TYPE] => application/x-www-form-urlencoded
[HTTP_REFERER] => http://www.izton.com/tcenter/manage_type/addUnit.do?gid=0&did=0&sid=0&tid=0
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
[HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8
[HTTP_ACCEPT_CHARSET] => GBK,utf-8;q=0.7,*;q=0.3
[HTTP_COOKIE] => PHPSESSID=8bc85489738f33e8909973ab534d7c80; KF360_6971_LIVE=Y; KF360_6971_REFERER=; PHPSESSID=ecb96ff35d7e68bdc14ffcfcd12835dc; KF360_6971_INVITEDTIMES=2; KF360_6971_VISITID=5666977; uname=172474; upass=123456; rem=1; Hm_lvt_b63d9415462f064e5fda5749bda4808f=1369358159; Hm_lpvt_b63d9415462f064e5fda5749bda4808f=1369641967; formhash=03bc8587; VISITORID=5269925
[PHP_SELF] => /index.php
[REQUEST_TIME] => 1369640436
[argv] => Array
(
)
[argc] => 0
)
两者的不同之处 ‘HTTPCONTENTTYPE’与‘HTTPCONNECTION’,‘HTTPCACHE_CONTROL’,
模板来回看了n遍,也没找到错误 下面是无法post数据的模板
回复内容:
php文件无法得到POST过来的数据,通过$_SERVER得到如下
Array
(
[HOSTNAME] => localhost.localdomain
[PATH] => /usr/local/bin:/usr/bin:/bin
[TMP] => /tmp
[TMPDIR] => /tmp
[TEMP] => /tmp
[OSTYPE] =>
[MACHTYPE] =>
[MALLOC_CHECK_] => 2
[USER] => www
[HOME] => /home/www
[FCGI_ROLE] => RESPONDER
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx
[QUERY_STRING] =>
[REQUEST_METHOD] => GET
[CONTENT_TYPE] =>
[CONTENT_LENGTH] =>
[SCRIPT_FILENAME] => /data0/htdocs/www_v2/index/htdocs/index.php
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /tcenter/manage_type/saveunitc/
[DOCUMENT_URI] => /index.php
[DOCUMENT_ROOT] => /data0/htdocs/www_v2/index/htdocs
[SERVER_PROTOCOL] => HTTP/1.1
[REMOTE_ADDR] => 222.130.133.84
[REMOTE_PORT] => 11347
[SERVER_ADDR] => 118.145.8.49
[SERVER_PORT] => 80
[SERVER_NAME] => *.izton.com
[REDIRECT_STATUS] => 200
[HTTP_HOST] => www.izton.com
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
[HTTP_REFERER] => http://www.izton.com/tcenter/manage_type/editunit.do?id=11016502&num=2
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
[HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8
[HTTP_ACCEPT_CHARSET] => GBK,utf-8;q=0.7,*;q=0.3
[HTTP_COOKIE] => PHPSESSID=8bc85489738f33e8909973ab534d7c80; KF360_6971_LIVE=Y; KF360_6971_REFERER=; PHPSESSID=ecb96ff35d7e68bdc14ffcfcd12835dc; KF360_6971_INVITEDTIMES=2; KF360_6971_VISITID=5666977; uname=172474; upass=123456; rem=1; Hm_lvt_b63d9415462f064e5fda5749bda4808f=1369358159; Hm_lpvt_b63d9415462f064e5fda5749bda4808f=1369641967; formhash=03bc8587; VISITORID=5269925
[PHP_SELF] => /index.php
[REQUEST_TIME] => 1369640508
[argv] => Array
(
)
[argc] => 0
)
但是在做项目的时候其他模板post的数据都可以接受,打印其中一个可接受到post数据的$_server
Array
(
[HOSTNAME] => localhost.localdomain
[PATH] => /usr/local/bin:/usr/bin:/bin
[TMP] => /tmp
[TMPDIR] => /tmp
[TEMP] => /tmp
[OSTYPE] =>
[MACHTYPE] =>
[MALLOC_CHECK_] => 2
[USER] => www
[HOME] => /home/www
[FCGI_ROLE] => RESPONDER
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx
[QUERY_STRING] =>
[REQUEST_METHOD] => POST
[CONTENT_TYPE] => application/x-www-form-urlencoded
[CONTENT_LENGTH] => 199
[SCRIPT_FILENAME] => /data0/htdocs/www_v2/index/htdocs/index.php
[SCRIPT_NAME] => /index.php
[REQUEST_URI] => /tcenter/manage_type/saveUnit.do
[DOCUMENT_URI] => /index.php
[DOCUMENT_ROOT] => /data0/htdocs/www_v2/index/htdocs
[SERVER_PROTOCOL] => HTTP/1.1
[REMOTE_ADDR] => 222.130.133.84
[REMOTE_PORT] => 10758
[SERVER_ADDR] => 118.145.8.49
[SERVER_PORT] => 80
[SERVER_NAME] => *.izton.com
[REDIRECT_STATUS] => 200
[HTTP_HOST] => www.izton.com
[HTTP_CONNECTION] => keep-alive
[HTTP_CONTENT_LENGTH] => 199
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ORIGIN] => http://www.izton.com
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
[HTTP_CONTENT_TYPE] => application/x-www-form-urlencoded
[HTTP_REFERER] => http://www.izton.com/tcenter/manage_type/addUnit.do?gid=0&did=0&sid=0&tid=0
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
[HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8
[HTTP_ACCEPT_CHARSET] => GBK,utf-8;q=0.7,*;q=0.3
[HTTP_COOKIE] => PHPSESSID=8bc85489738f33e8909973ab534d7c80; KF360_6971_LIVE=Y; KF360_6971_REFERER=; PHPSESSID=ecb96ff35d7e68bdc14ffcfcd12835dc; KF360_6971_INVITEDTIMES=2; KF360_6971_VISITID=5666977; uname=172474; upass=123456; rem=1; Hm_lvt_b63d9415462f064e5fda5749bda4808f=1369358159; Hm_lpvt_b63d9415462f064e5fda5749bda4808f=1369641967; formhash=03bc8587; VISITORID=5269925
[PHP_SELF] => /index.php
[REQUEST_TIME] => 1369640436
[argv] => Array
(
)
[argc] => 0
)
两者的不同之处 ‘HTTPCONTENTTYPE’与‘HTTPCONNECTION’,‘HTTPCACHE_CONTROL’,
模板来回看了n遍,也没找到错误 下面是无法post数据的模板
感觉是个低级错误,你上边打出来的$server 里method 是GET ,提交get请求肯定没有$POST了
“
[REQUEST_METHOD] => GET
”
上一篇: php-java-bridge安装问题
下一篇: 关于微信公众平台用户发送关键词的回复机制
推荐阅读
-
用PHP实现动态产生XML文件以及从XML文件中抽取数据转化成HTML的小程序。。。不用DOM的。。_PHP教程
-
html网页中插入script脚本,src指向php文件,怎么在html中显示php返回的数据?求大神赐教。
-
无法得到post过来的值,该怎么解决
-
多个表单php怎么接收post过来的数据呢
-
用PHP的超级变量$_POST获取HTML表单(HTML Form) 数据_php入门_脚
-
如何实现从html理post到一php文件数据后在php文件中核查数据,如果数据有错在html里面弹出提示重新输入
-
php 解析HTML post过来的json字符串
-
用php实现动态产生xml文件以及从xml文件中抽取数据转化成html的_PHP教程
-
php提交过来的数据生成为txt文件,_PHP教程
-
如何从一个php文件向另一个地址post数据,不用表单和隐藏的变量_PHP