명

Modify HTTP Headers (Examples)

인터넷으로 찾을려면 귀찮은거.. 요기에다 남겨둡니다.

// See related links for more status codes
 
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
 
// Page was not found:
header('HTTP/1.1 404 Not Found');
 
// Access forbidden:
header('HTTP/1.1 403 Forbidden');
 
// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
header('HTTP/1.1 301 Moved Permanently');
 
// Server error
header('HTTP/1.1 500 Internal Server Error');
 
// Redirect to a new location:
header('Location: http://www.example.org/');
 
// Redriect with a delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
 
// you can also use the HTML syntax:
// <meta http-equiv="refresh" content="10;http://www.example.org/ />
 
// override X-Powered-By value
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 past
header('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';

댓글 7개

download 하는 부분과, no-cache, Last-Modified 는 찾을때마다 귀찮아서..
감사 합니다. ㅎㅎ
감사감사...
하얀건 배색이고 검은건 글자고
유용합니다.감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
11-08-25 조회 3,691
11-08-25 조회 2,890
11-08-25 조회 2,583
11-08-24 조회 2,481
11-08-24 조회 3,113
11-08-24 조회 4,433
11-08-23 조회 2,504
11-08-23 조회 4,342
11-08-23 조회 3,482
11-08-23 조회 2,566
11-08-23 조회 2,794
11-08-23 조회 2,715
11-08-23 조회 2,845
11-08-23 조회 2,302
11-08-23 조회 2,442
11-08-23 조회 2,608
11-08-23 조회 3,012
11-08-23 조회 2,601
11-08-22 조회 3,043
11-08-22 조회 2,755
11-08-22 조회 2,899
11-08-22 조회 2,495
11-08-22 조회 2,764
11-08-21 조회 2,703
11-08-21 조회 2,633
11-08-20 조회 2,530
11-08-20 조회 2,897
11-08-20 조회 3,324
11-08-19 조회 2,736
11-08-19 조회 2,517
11-08-19 조회 5,049
11-08-19 조회 2,668
11-08-19 조회 2,521
11-08-19 조회 3,790
11-08-19 조회 3,231
11-08-18 조회 3,724
11-08-18 조회 2,255
11-08-18 조회 2,485
11-08-18 조회 2,314
11-08-18 조회 2,162
11-08-18 조회 2,282
11-08-18 조회 2,412
11-08-17 조회 3,210
11-08-17 조회 2,603
11-08-17 조회 2,744
11-08-17 조회 2,288
11-08-17 조회 2,708
11-08-17 조회 3,422
11-08-17 조회 2,827
11-08-16 조회 3,069
11-08-16 조회 2,571
11-08-16 조회 2,656
11-08-16 조회 2,522
11-08-16 조회 2,854
11-08-16 조회 2,655
11-08-16 조회 2,070
11-08-16 조회 2,229
11-08-16 조회 2,281
11-08-16 조회 2,639
11-08-16 조회 2,541
11-08-16 조회 2,533
11-08-15 조회 2,493
11-08-15 조회 3,021
11-08-13 조회 2,647
11-08-13 조회 2,685
11-08-13 조회 2,576
11-08-12 조회 2,358
11-08-12 조회 3,498
11-08-12 조회 3,286
11-08-12 조회 2,726
11-08-12 조회 2,526
11-08-11 조회 3,708
11-08-11 조회 3,001
11-08-11 조회 2,938
11-08-11 조회 2,465
11-08-10 조회 3,239
11-08-10 조회 5,454
11-08-10 조회 4,150
11-08-09 조회 2,728
11-08-09 조회 2,332
11-08-09 조회 2,410
11-08-09 조회 3,032
11-08-09 조회 2,686
11-08-09 조회 2,975
11-08-08 조회 3,068
11-08-08 조회 3,113
11-08-08 조회 2,207
11-08-08 조회 2,485
11-08-08 조회 4,404
11-08-08 조회 2,424
11-08-08 조회 2,953
11-08-08 조회 2,504
11-08-08 조회 2,307
11-08-08 조회 3,082
11-08-08 조회 2,338
11-08-07 조회 3,151
11-08-07 조회 2,703
11-08-06 조회 3,314
11-08-06 조회 3,321
11-08-06 조회 2,881