Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

http - 如何在HTTP POST请求中发送参数?(How are parameters sent in an HTTP POST request?)

In an HTTP GET request, parameters are sent as a query string :

(在HTTP GET请求中,参数作为查询字符串发送:)

http://example.com/page?parameter=value&also=another)

In an HTTP POST request, the parameters are not sent along with the URI.

(在HTTP POST请求中,参数不会与URI一起发送。)

Where are the values?

(价值在哪里?)

In the request header?

(在请求标头中?)

In the request body?

(在请求正文中?)

What does it look like?

(它是什么样子的?)

  ask by Camilo Martin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The values are sent in the request body, in the format that the content type specifies.

(值以内容类型指定的格式在请求正文中发送。)

Usually the content type is application/x-www-form-urlencoded , so the request body uses the same format as the query string:

(通常,内容类型为application/x-www-form-urlencoded ,因此请求正文使用与查询字符串相同的格式:)

parameter=value&also=another

When you use a file upload in the form, you use the multipart/form-data encoding instead, which has a different format.

(当您使用表单上载文件时,将改用multipart/form-data编码,格式不同。)

It's more complicated, but you usually don't need to care what it looks like, so I won't show an example, but it can be good to know that it exists.

(它更复杂,但是您通常不需要关心它的外观,因此我不会显示示例,但是知道它的存在可能会很好。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...