vc6.0 mfc界面设计:PHP语言:header()函数

来源:百度文库 编辑:高校问答 时间:2024/05/01 03:15:20
看到很多header()函数相关文章,但还是不清楚,具体他在网页中能起到什么作用?加了和不加有什么区别?有什么好处?

例如这段:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Language: charset=zh-cn");
header("Content-type: text/html; charset=GB2312");
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
和header("Content-type: text/html; charset=GB2312");
是一样的效果吧?那为什么要用
header("Content-type: text/html; charset=GB2312");

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
上面组合是禁用缓存

header("Content-Language: charset=zh-cn");
说明字符集是简体中文

header("Content-type: text/html; charset=GB2312");
说明本页面是HTML内容,字符集是简体中文