重定向到其他页面:
header("Location: http://www.example.com");exit;
强制下载文件:header("Content-Disposition: attachment; filename='example.pdf'");header("Content-Type: application/pdf");readfile("path/to/example.pdf");
设置刷新页面时间:header("Refresh: 5; url=http://www.example.com");echo "页面将在5秒后刷新到新的页面";
设置页面编码:header("Content-Type: text/html; charset=UTF-8");
禁止页面缓存:header("Cache-Control: no-cache, no-store, must-revalidate");header("Pragma: no-cache");header("Expires: 0");
设置页面状态码:header("HTTP/1.1 404 Not Found");
设置文件下载大小:header("Content-Length: " . filesize("path/to/example.pdf"));