Home > Backend Development > PHP Tutorial > POST字符串问题

POST字符串问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:49:42
Original
1155 people have browsed it

HTTP协议是否有规定,POST过来的内容必须以键值对的形式提交? 直接POST字符串,PHP的$_POST没有办法接收的到,请问有什么办法能让PHP接收到POST过来的字符串呢?

回复内容:

HTTP协议是否有规定,POST过来的内容必须以键值对的形式提交? 直接POST字符串,PHP的$_POST没有办法接收的到,请问有什么办法能让PHP接收到POST过来的字符串呢?

想要是是这个吗?

<code>php://input
</code>
Copy after login

很多年没碰php了,直觉上肯定是可以的,这个也许是你想要的:http://php.net/manual/en/reserved.variables.httprawpostdata.php

1.默认情况下 POST 是 k-v 的数组 2.你的情况需要用 php://input

$GLOBALS["HTTPRAWPOSTDATA"]或者fileget_contents('php://input');

默认情况下 HTML 产生的 POST 请求的 Content-Type 是 application/x-www-form-urlencoded,也就是我们理解的 key-value 形式的表单。

但是,既然有 Content-Type,那么就 HTTP 协议来说它可以是其它类型的!比如 application/json,比如 text/plain。当然服务器那头怎么处理就是服务器的事情了。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template