header("Content-type:text/html;charset=utf-8");什么意思

如题所述

它的意思是设置页面内容是html,编码格式是utf-8。

header()函数的作用是:发送一个原始 HTTP 标头[Http Header]到客户端。
标头 (header) 是服务器以 HTTP 协义传 HTML 资料到浏览器前所送出的字串,在标头与 HTML 文件之间尚需空一行分隔。在 PHP 中送回 HTML 资料前,需先传完所有的标头。

常用header汇总:

header('Content-Type: text/html; charset=utf-8'); //网页编码

header('Content-Type: text/plain'); //纯文本格式

header('Content-Type: image/jpeg'); //JPG、JPEG

header('Content-Type: application/zip'); // ZIP文件

header('Content-Type: application/pdf'); // PDF文件

header('Content-Type: audio/mpeg'); // 音频文件

header('Content-type: text/css'); //css文件

header('Content-type: text/javascript'); //js文件

header('Content-type: application/json'); //json

header('Content-type: application/pdf'); //pdf

header('Content-type: text/xml'); //xml

header('Content-Type: application/x-shockw**e-flash'); //Flash动画

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-02-14
设置页面内容是html
编码格式是utf-8本回答被提问者和网友采纳
第2个回答  2011-11-27
有谁知道下面这段是什么编码的中文字符? 在php中怎么把他转换成utf8的中文header("Content-Type:text/html;charset=utf-8"); echo urldecode('%E5
第3个回答  2017-08-03
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
类似这个,是定义编码和页面
第4个回答  2019-12-24
不同的情况翻译会有所不同,我觉得在某种场合下可以翻译为领头羊。