In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "php how to set content-type", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to set php content-type" this article.
In php, you can use the header () function to set the content-type (content type), which sends the original HTTP header to the client with the syntax "header ('Content-type: type value');".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Content-Type (content type), generally refers to the Content-Type that exists in the web page, which is used to define the type of network file and the coding of the web page, and to determine what form and encoding the browser will read the file. This is why you often see some PHP pages click on the result is to download a file or a picture.
The Content-Type header tells the client the type of content that is actually returned.
In PHP, you can send header information through the header () function, and you can also set the content-type of the file. Here are some content-type values for common file types.
/ / define the code header ('Content-Type:text/html;charset=utf-8'); / / Atom header ('Content-type: application/atom+xml'); / / CSS header (' Content-type: text/css'); / / Javascript header ('Content-type: text/javascript'); / / JPEG Image header (' Content-type: image/jpeg'); / / JSON header ('Content-type: application/json') / / PDF header ('Content-type: application/pdf'); / / RSS header (' Content-Type: application/rss+xml; charset=ISO-8859-1'); / / Text (Plain) header ('Content-type: text/plain'); / / XML header (' Content-type: text/xml'); / / ok header ('HTTP/1.1 200 OK'); / / set a 404 header: header (' HTTP/1.1 404 Not Found') / / set the address to be permanently redirected header ('HTTP/1.1 301 Moved Permanently'); / / go to a new address header (' Location: http://www.example.org/'); / / File delay redirection: header ('Refresh: 10; url= http://www.example.org/'); print' You will be redirected in 10 seconds'; / / of course, it can also be implemented using HTML syntax / /
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.