您的位置:首页 > 其它

header函数运用

2016-04-27 16:38 435 查看
header 函数 用于发送原生的 HTTP 头

1 .跳转

header("Location: http://www.example.com/");[/code] 
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");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: