您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php header函数怎么设置HTTP头

2026/2/15 13:00:43发布10次查看
php header函数设置http头的方法:【header( 'content-type:text/html;charset=utf-8 ');】,表示设置编码为utf-8。
php header函数设置http头的示例如下:
(视频教程推荐:java视频教程)
定义编码
header( 'content-type:text/html;charset=utf-8 ');
设置一个404头:
header('http/1.1 404 not found');
设置地址被永久的重定向
header('http/1.1 301 moved permanently');
转到一个新地址
header('location: http://www.example.org/');
文件延迟转向:
header('refresh: 10; url=http://www.example.org/');print 'you will be redirected in 10 seconds';
告诉浏览器最后一次修改时间
$time = time() - 60; // or filemtime($fn), etcheader('last-modified: '.gmdate('d, d m y h:i:s', $time).' gmt');
对当前文档禁用缓存
header('cache-control: no-cache, no-store, max-age=0, must-revalidate');header('expires: mon, 26 jul 1997 05:00:00 gmt'); // date in the pastheader('pragma: no-cache');
相关推荐:php培训
以上就是php header函数怎么设置http头的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product