最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP header函數(shù)分析詳解

 更新時(shí)間:2011年08月06日 19:36:36   作者:  
PHP只是以HTTP協(xié)議將HTML文檔的標(biāo)頭送到瀏覽器,告訴瀏覽器具體怎么處理這個(gè)頁(yè)面,至于傳送的內(nèi)容則需要熟悉一下HTTP協(xié)議了,與PHP無關(guān)
在php語(yǔ)言中,header()這個(gè)函數(shù)很有用的,尤其在用到ajax時(shí)候,他會(huì)幫你解決一些意想不到的問題。下面是header的一些詳細(xì)講解。希望對(duì)phper有幫助
復(fù)制代碼 代碼如下:

<?php
// fix 404 pages:
header('HTTP/1.1 200 OK');
// set 404 header:
header('HTTP/1.1 404 Not Found');
// set Moved Permanently header (good for redrictions)
// use with location header
header('HTTP/1.1 301 Moved Permanently');
// redirect to a new location:
header('Location: http://www.example.org/');
// redrict with delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
// you could also use the HTML syntax:// <meta http-equiv="refresh" content="10;http://www.example.org/ />
// override X-Powered-By: PHP:
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
// content language (en = English)
header('Content-language: en');
// last modified (good for caching)
$time = time() – 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
// set content length (good for caching):
header('Content-Length: 1234');
// Headers for an download:
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');
// Disable caching of the current document:
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 pastheader('Pragma: no-cache');
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain');
// plain text file
header('Content-Type: image/jpeg');
// JPG picture
header('Content-Type: application/zip');
// ZIP file
header('Content-Type: application/pdf');
// PDF file
header('Content-Type: audio/mpeg');
// Audio MPEG (MP3,…) file
header('Content-Type: application/x-shockwave-flash');
// Flash animation// show sign in box
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';
?>

相關(guān)文章

最新評(píng)論

靖西县| 虹口区| 东乡| 朝阳区| 太原市| 柏乡县| 宿州市| 康定县| 临湘市| 肃宁县| 宜昌市| 西乌珠穆沁旗| 铅山县| 木兰县| 西城区| 东方市| 玉屏| 桂林市| 阿拉善右旗| 淳安县| 高尔夫| 宜都市| 错那县| 翁牛特旗| 定西市| 夏邑县| 富平县| 砀山县| 饶平县| 图们市| 桃江县| 蒙山县| 安乡县| 阳东县| 天峨县| 凤庆县| 成安县| 密云县| 嘉义市| 喀喇沁旗| 扬州市|