Home > Article > Backend Development > What is the role of Content-Type?
Content-Type The entity header is used to indicate the MIME type media type of the resource.
In the response, the Content-Type header tells the client the content type of the actual content returned. Browsers perform MIME lookups in some cases and do not necessarily honor the value of this header; to prevent this behavior, the header X-Content-Type-Options can be set to nosniff.
In the request (such as POST or PUT), the client tells the server the type of data actually sent.
Syntax:
Content-Type: text/html; charset=utf-8 Content-Type: multipart/form-data; boundary=something
Directions:
media-type
The MIME type of the resource or data.
charset
Character encoding standard.
boundary
A boundary is required for multipart entities, which consists of 1 to 70 characters from a set of characters known to be very robust through email gateways, rather than ending in whitespace. It is used to encapsulate the boundaries of multiple parts of a message.
Example
##Content-Type in HTML form
In the POST request generated by submitting the HTML form, request The Content-Type of the header is specified by the enctype attribute on theThe above is the detailed content of What is the role of Content-Type?. For more information, please follow other related articles on the PHP Chinese website!