欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php header()

程序员文章站 2024-01-15 16:30:04
...
使用范例
范例一: 本例使浏览器重定向到 PHP 的官方网站。
Header("Location: http://www.php.net ";);
exit;
?>
范例二: 要使用者每次都能得到最新的资料,而不是 Proxy 或 cache 中的资料,可以使用下列的标头
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
范例三: 让使用者的浏览器出现找不到档案的信息。
header("Status: 404 Not Found");
?>
范例四:让使用者下载档案。header("Content-type: application/x-gzip");
header("Content-Disposition: attachment; filename=文件名");
header("Content-Descrīption: PHP3 Generated Data");
?>
相关标签: php header()