php设置响应头
1、设置响应头文件类型
<?php
header('Content-Type:text/css;charset=GBK');//css文件类型,GBK编码
header('Content-Type:text/html;charset=UTF-8');//html文件类型,UTF-8类型
header('Content-Type:text/plain');//纯文件类型,不会做任何解析
header('Content-Type:applcation/javascript');//javascript文件类型
?>
2、重定向(跳转到其它网页)
header('Location:https://www.baidu.com');//跳转到百度网页
?>
3、下载文件
<?php
header('Content-Type:application/octet-stream');//设置文件下载
header('Content-Disposition:attachment;filename=dome.txt');
?>
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END


![表情[ciya]-红穆笔记](https://www.4s5.cn/wp-content/themes/zibll/img/smilies/ciya.gif)
![表情[xia]-红穆笔记](https://www.4s5.cn/wp-content/themes/zibll/img/smilies/xia.gif)


暂无评论内容