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 PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
4 可以设置很多http 头
header("Cache-Control: no-cache");
header("Pragma: no-cache");