简体   繁体   English

Content-Type 标头值

[英]Content-Type header value

What does Content-Type header field really mean in the request? Content-Type标头字段在请求中的真正含义是什么? Tho official docs say官方文档

tells the server what type of data is actually sent告诉服务器实际发送的数据类型

But i'm a little confused here.但我在这里有点困惑。 If i'm right that setting different values of that filed doesn't influence the data format/shape but only informs the receiver ( php script for eg) how to treat the data making it accessible in different ways like php://input or $_POST variable.如果我是对的,设置该文件的不同值不会影响数据格式/形状,但只会通知接收者(例如php脚本)如何处理数据,使其可以通过不同的方式访问,例如php://input$_POST变量。 So the data being send is always the same but the way it's accessible on the server is different based on Content-Type vale?所以发送的数据总是相同的,但它在服务器上的访问方式因Content-Type值而异?


Why was my question downvoted?为什么我的问题被否决了? What's wrong with it?它出什么问题了?

You are right in your understanding that the data format does not change based on the value of the "Content-Type" header.您的理解是正确的,数据格式不会根据“Content-Type”标头的值而改变。 It is only an indication to the server, that the client is sending a particular type of content.它只是对服务器的一个指示,表明客户端正在发送特定类型的内容。 It is up-to the server to decide how to process a particular type of data.由服务器决定如何处理特定类型的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM