header函数运用

来源:互联网 发布:天盾android数据恢复 编辑:程序博客网 时间:2024/06/03 20:47

header 函数 用于发送原生的 HTTP 头

1 .跳转

header("Location: http://www.example.com/");

2.设置编码

header("Content-type:text/html;charset=utf-8"); 

3.下载等等

<?php// We'll be outputting a PDFheader('Content-type: application/pdf');// It will be called downloaded.pdfheader('Content-Disposition: attachment; filename="downloaded.pdf"');// The PDF source is in original.pdfreadfile('original.pdf');

4 可以设置很多http 头

 header("Cache-Control: no-cache");  header("Pragma: no-cache");
0 0
原创粉丝点击