PHP
·
发表于 5年以前
·
阅读量:8305
//ok
header(¡®HTTP/1.1 200 OK');
//ÉeÖÃÒ»¸o404Í*:
header(¡®HTTP/1.1 404 Not Found');
//ÉeÖõØÖ*±»ÓÀ¾ÃµÄÖض¨Ïo
header(¡®HTTP/1.1 301 Moved Permanently');
//תµ½Ò»¸oеØÖ*
header(¡®Location: http://www.example.org/¡®);
//ÎļþÑÓ³ÙתÏo:
header(¡®Refresh: 10; url=http://www.example.org/¡®);
print ¡®You will be redirected in 10 seconds';
//µ±È»£¬Ò²¿ÉÒÔʹÓÃhtmlÓi*¨ÊµÏÖ
// <meta http-equiv=¡±refresh¡± content=¡±10;http://www.example.org/ />
// override X-Powered-By: PHP:
header(¡®X-Powered-By: PHP/4.4.0¡a);
header(¡®X-Powered-By: Brain/0.6b');
//ÎĵµÓiÑÔ
header(¡®Content-language: en');
//¸aeËßa¯ÀÀÆ÷×iºoÒ»´ÎÐÞ¸Äʱ¼a
$time = time() ¨C 60; // or filemtime($fn), etc
header(¡®Last-Modified: ¡®.gmdate(¡®D, d M Y H:i:s', $time).' GMT');
//¸aeËßa¯ÀÀÆ÷ÎĵµÄÚÈÝûÓÐ*¢Éu¸Ä±a
header(¡®HTTP/1.1 304 Not Modified');
//ÉeÖÃÄÚÈݳ¤¶È
header(¡®Content-Length: 1234¡a);
//ÉeÖÃΪһ¸oÏÂÔØÀaÐÍ
header(¡®Content-Type: application/octet-stream');
header(¡®Content-Disposition: attachment; filename=¡±example.zip¡±¡®);
header(¡®Content-Transfer-Encoding: binary');
// load the file to send:
readfile(¡®example.zip');
// ¶Ôµ±Ç°Îĵµ½uÓûº´ae
header(¡®Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header(¡®Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header(¡®Pragma: no-cache');
//ÉeÖÃÄÚÈÝÀaÐÍ:
header(¡®Content-Type: text/html; charset=iso-8859-1¡a);
header(¡®Content-Type: text/html; charset=utf-8¡a);
header(¡®Content-Type: text/plain'); //´¿Îı¾¸ñʽ
header(¡®Content-Type: image/jpeg'); //JPG***
header(¡®Content-Type: application/zip'); // ZIPÎļþ
header(¡®Content-Type: application/pdf'); // PDFÎļþ
header(¡®Content-Type: audio/mpeg'); // ÒoƵÎļþ
header(¡®Content-Type: application/x-shockw**e-flash'); //Flash¶¯»
//ÏÔʾµÇ½¶Ô»°¿o
header(¡®HTTP/1.1 401 Unauthorized');
header(¡®WWW-Authenticate: Basic realm=¡±Top Secret¡±¡®);
print ¡®Text that will be displayed if the user hits cancel or ¡®;
print ¡®enters wrong login data';