header(string,replace,http_response_code)
string 必需,規(guī)定要發(fā)送的報(bào)頭字符串.
replace 可選,指示該報(bào)頭是否替換之前的報(bào)頭,或添加第二個(gè)報(bào)頭.
默認(rèn)是 true(替換),false(允許相同類型的多個(gè)報(bào)頭).
http_response_code 可選,把 http 響應(yīng)代碼強(qiáng)制為指定的值,(php 4 以及更高版本可用)
跳轉(zhuǎn):
header('location: http://www.phpfensi.com/');發(fā)送http狀態(tài)
header("status: 404 not found");
設(shè)置緩存:
header("cache-control: no-cache, must-revalidate"); // http/1.1
header("expires:sat,26 jul 1997 05:00:00 gmt");
利用header做文件下載功能: