天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

基于header的一些常用指令詳解

header常用指令
header分為三部分:
第一部分為HTTP協(xié)議的版本(HTTP-Version);
第二部分為狀態(tài)代碼(Status);
第三部分為原因短語(Reason-Phrase)。

// fix 404 pages:   用這個header指令來解決URL重寫產生的404 header
header('HTTP/1.1 200 OK');  

// set 404 header:   頁面沒找到
header('HTTP/1.1 404 Not Found');  

//頁面被永久刪除,可以告訴搜索引擎更新它們的urls
// set Moved Permanently header (good for redrictions)  
// use with location header  
header('HTTP/1.1 301 Moved Permanently'); 

// 訪問受限
header('HTTP/1.1 403 Forbidden');

// 服務器錯誤
header('HTTP/1.1 500 Internal Server Error');

// 重定向到一個新的位置
// 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';  

// 覆蓋 X-Powered-By value
// override X-Powered-By: php:  
header('X-Powered-By: php/4.4.0');  
header('X-Powered-By: Brain/0.6b');  

// 內容語言 (en = English)
// 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');  

// 顯示登錄對話框,可以用來進行HTTP認證
// 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';?>

// 發(fā)送一個200 正常響應
header("HTTP/1.1 200 OK");

// 發(fā)送一個404 找不到資源響應
header('HTTP/1.1 404 Not Found');

// 發(fā)送一個301 永久重定向
header('HTTP/1.1 301 Moved Permanently');

// 發(fā)送一個503 網站暫時不能訪問
header('HTTP/1.1 503 Service Temporarily Unavailable');

// 網頁重定向
header('Location: http://www.jb51.NET');

// 設置網頁3秒后重定向
header('Refresh: 3; url=http://www.jb51.NET');
echo '網頁將在3秒后跳轉到http://www.jb51.NET';

// 設置網頁編碼
header('Content-Type: text/html; charset=utf-8');

// 設置網頁輸出一個圖片流
header('Content-Type: image/jpeg');

// 設置網頁輸出一個pdf文檔
header('Content-Type: application/pdf');

// 設置網頁輸出一個zip文檔
header('Content-Type: application/zip');

php技術基于header的一些常用指令詳解,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 欧美丰满少妇久久无码精品 | 快播最新电影网站 | 久久日本精品在线热 | 国产无遮挡色视频免费观看性色 | ppypp午夜限制不卡影院私人 | 久久精品视在线观看85 | 免费观看国产视频 | 亚洲国产精品免费线观看视频 | 黄色三级网址 | 久久精品国产在热亚洲 | 无限资源在线完整高清观看1 | 九九免费的视频 | 抽插H浊水H嫩B父皇 虫族bl文全肉高h | 中文字幕在线观看亚洲 | 秘密教学93话恩爱久等了免费 | 日本理论片和搜子同居的日子2 | 亚洲国产在线视频中文字 | 国产午夜精品美女免费大片 | 国产精品第1页 | 秋霞三级理伦免费观看 | 国产h视频在线观看免费 | 男人把女人桶到爽免费看视频 | 神马电影dy888午夜我不卡 | 刘梓晨啪啪啪 | 久久精品国产亚洲AV妓女不卡 | 美女被男人撕衣舔胸 | 男男女女爽爽爽视频免费 | 午夜看片网 | 99久久精品毛片免费播放 | 亚洲精品无AMM毛片 亚洲精品网址 | 亚洲性无码AV久久成人 | yy8090理论三级在线看 | 亚洲第一免费播放区 | 精品人伦一区二区三区潘金莲 | 欧美精品一区二区蜜臀亚洲 | 国产高清视频在线观看97 | 亚洲一区免费看 | 红杏俱乐部 | 九色PORNY蝌蚪视频首页 | 免费精品国偷自产在线 | 男人插女人逼逼 |