php header函数怎么设置HTTP头
互联网
20-11-4
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 ');
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), etc header('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 past header('Pragma: no-cache');相关推荐:php培训
以上就是php header函数怎么设置HTTP头的详细内容,更多内容请关注技术你好其它相关文章!
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场