1、php提供header()函數用來將html文檔的表頭以http協議發送至瀏覽器,高速瀏覽器如何處理這個頁面:
header(string $str_header);
$str_header可以取很多值,用的最多的是以下三種:
Content-Type:xxxx/yyyyy
Location:xxxx:yyyy/zzzz
Status:nnn xxxxx
在調用header()之前不能有任何輸出
例一:重定向
<?
header('location:http://www.cuit.edu.cn'); //重定向網站
die();
?>
例二:限制某網頁不能被用戶訪問
<?
header("Status:404 Not Found");
?>