PHP的header函数是最常用的函数之一,用于向客户端发送HTTP头信息。
通过的用法如设置编码、发送HTTP状态值以及重定向。
php header utf8 :
header(“Content-type: text/html; charset=utf-8″);
php header 404 :
header(“HTTP/1.0 404 Not Found”);
上述两个例子分别是设置UTF8编码和发送404状态。
header重定向:
header(‘Location: http://www.phpthinking.com');
其他常用的Header用法:
// Header永久性重定向,一般301与header Location一起使用.
header(‘HTTP/1.1 301 Moved Permanently'); header(‘Location: http://www.phpthinking.com/');
// Header延时刷新页面
//与HTML页面中的<meta http-equiv=”refresh” content=”10;http://www.phpthinking.com” />效果一样 header(‘Refresh: 10; url=http://www.phpthinking.com/');
// Header设置页面语言
header(‘Content-language: en');
// 对于下载页面,可以声明文件类型和文件名
header(‘Content-Type: application/octet-stream'); header(‘Content-Disposition: attachment; filename=”filename.zip”‘); header(‘Content-Transfer-Encoding: binary');
// Header设置缓存和缓存过期时间
header(‘Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Header设置页面编码:
header(‘Content-Type: text/html; charset=utf-8′);
风云阁资源网 Design By www.bgabc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
风云阁资源网 Design By www.bgabc.com
暂无评论...
更新日志
2024年09月23日
2024年09月23日
- 梁汉文2008-EDMONDHITS48[香港]3CD[WAV+CUE]
- 国风大师纯音系列《童丽-[渭城曲]》1CD[WAV分轨][593.5MB]
- 国风大师纯音系列《许菱子《烧筝2》古筝曲集》1CD[WAV分轨][1.3GB]
- 王子异《1996 Part.2》[320K/MP3][18.29MB]
- 群星.1994-宝丽金最倾情3CD【宝丽金】【WAV+CUE】
- 乐俊亨.2024-同泪【CharioticMusic】【FLAC分轨】
- 何耀珊.2006-收获【华纳】【WAV+CUE】
- 梁汉文1994-壹精选[华星][WAV+CUE]
- 洪荣宏1981-歹路不可行·相思雨(飞跃复刻版)[光美][WAV+CUE]
- 旅行团2015-10Day’s[来福胶泥][WAV+CUE]
- 龙千玉.2011-卡将哟【豪记】【WAV+CUE】
- 蔣志光.1993-多情多寂寞(国专)【BMG】【WAV+CUE】
- 陈慧娴.1996-雪映美白96演唱会2CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 王子异《1996 Part.2》[FLAC/分轨][50.66MB]
- 贵族音乐《古典名曲与轻音乐钢琴 打开宝宝睡眠开关》[320K/MP3][155.91MB]