명

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건
+
제목 글쓴이 날짜 조회
12-02-26 조회 3,179
12-02-26 조회 3,496
12-02-26 조회 3,341
12-02-26 조회 3,420
12-02-26 조회 3,465
12-02-26 조회 3,320
12-02-26 조회 3,643
12-02-26 조회 3,477
12-02-26 조회 3,559
12-02-26 조회 4,041
12-02-26 조회 2,991
12-02-26 조회 5,184
12-02-25 조회 2,750
12-02-25 조회 3,230
12-02-24 조회 2,932
12-02-24 조회 3,313
12-02-24 조회 3,291
12-02-24 조회 3,606
12-02-24 조회 3,139
12-02-24 조회 3,944
12-02-24 조회 3,915
12-02-24 조회 3,511
12-02-24 조회 9,369
12-02-23 조회 2,876
12-02-23 조회 3,322
12-02-23 조회 3,224
12-02-23 조회 3,165
12-02-23 조회 3,811
12-02-23 조회 2,896
12-02-23 조회 3,375
12-02-23 조회 3,054
12-02-23 조회 2,810
12-02-22 조회 3,710
12-02-22 조회 5,472
12-02-22 조회 3,027
12-02-22 조회 4,425
12-02-22 조회 3,296
12-02-22 조회 3,119
12-02-22 조회 4,033
12-02-22 조회 3,917
12-02-22 조회 2,845
12-02-22 조회 3,886
12-02-22 조회 4,345
12-02-22 조회 3,769
12-02-22 조회 2,949
12-02-22 조회 4,599
12-02-21 조회 3,161
12-02-21 조회 2,941
12-02-21 조회 2,847
12-02-21 조회 3,756
12-02-21 조회 3,995
12-02-21 조회 3,417
12-02-21 조회 2,930
12-02-20 조회 3,174
12-02-20 조회 3,808
12-02-20 조회 3,757
12-02-20 조회 3,039
12-02-20 조회 5,820
12-02-20 조회 3,618
12-02-20 조회 6,832
12-02-20 조회 3,229
12-02-20 조회 4,204
12-02-19 조회 3,387
12-02-18 조회 3,122
12-02-18 조회 3,864
12-02-17 조회 2,999
12-02-17 조회 4,188
12-02-17 조회 3,070
12-02-17 조회 3,633
12-02-17 조회 3,405
12-02-17 조회 6,273
12-02-17 조회 4,466
12-02-17 조회 3,093
12-02-17 조회 3,122
12-02-17 조회 3,482
12-02-16 조회 3,308
12-02-16 조회 3,380
12-02-16 조회 4,745
12-02-16 조회 2,994
12-02-16 조회 5,381
12-02-16 조회 5,129
12-02-15 조회 3,675
12-02-15 조회 3,295
12-02-15 조회 4,834
12-02-15 조회 3,327
12-02-15 조회 3,719
12-02-15 조회 2,795
12-02-15 조회 4,067
12-02-14 조회 3,584
12-02-14 조회 3,689
12-02-14 조회 4,097
12-02-14 조회 3,138
12-02-14 조회 6,219
12-02-14 조회 3,170
12-02-14 조회 4,193
12-02-13 조회 3,469
12-02-13 조회 3,088
12-02-13 조회 7,236
12-02-12 조회 2,909
12-02-12 조회 5,286