명

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-12-23 조회 4,102
11-12-23 조회 3,044
11-12-23 조회 4,870
11-12-23 조회 4,443
11-12-23 조회 2,797
11-12-23 조회 8,127
11-12-22 조회 3,117
11-12-22 조회 3,857
11-12-22 조회 3,611
11-12-22 조회 3,520
11-12-22 조회 3,716
11-12-21 조회 3,566
11-12-21 조회 3,341
11-12-21 조회 3,639
11-12-21 조회 4,028
11-12-21 조회 3,053
11-12-21 조회 3,554
11-12-21 조회 4,482
11-12-21 조회 4,300
11-12-21 조회 3,331
11-12-20 조회 3,798
11-12-19 조회 6,299
11-12-19 조회 2,975
11-12-19 조회 5,054
11-12-17 조회 3,906
11-12-17 조회 4,283
11-12-17 조회 3,574
11-12-16 조회 3,177
11-12-16 조회 3,338
11-12-15 조회 3,391
11-12-15 조회 3,501
11-12-15 조회 4,307
11-12-15 조회 5,609
11-12-15 조회 4,595
11-12-15 조회 3,267
11-12-15 조회 4,037
11-12-15 조회 4,211
11-12-14 조회 2,967
11-12-14 조회 4,395
11-12-14 조회 5,641
11-12-13 조회 4,203
11-12-13 조회 5,098
11-12-13 조회 6,118
11-12-13 조회 6,408
11-12-13 조회 4,814
11-12-12 조회 3,317
11-12-12 조회 3,623
11-12-12 조회 6,295
11-12-12 조회 4,689
11-12-12 조회 3,822
11-12-12 조회 6,187
11-12-11 조회 4,706
11-12-10 조회 2,823
11-12-10 조회 4,767
11-12-09 조회 2,869
11-12-09 조회 3,275
11-12-09 조회 4,201
11-12-09 조회 3,814
11-12-09 조회 4,022
11-12-09 조회 3,567
11-12-09 조회 4,525
11-12-09 조회 3,206
11-12-09 조회 3,351
11-12-09 조회 3,028
11-12-09 조회 3,844
11-12-08 조회 3,615
11-12-08 조회 3,564
11-12-08 조회 7,880
11-12-08 조회 4,186
11-12-08 조회 3,675
11-12-08 조회 2,919
11-12-08 조회 1.2만
11-12-08 조회 4,004
11-12-07 조회 2,874
11-12-07 조회 2,910
11-12-07 조회 3,954
11-12-07 조회 4,553
11-12-07 조회 4,020
11-12-07 조회 3,113
11-12-07 조회 4,440
11-12-06 조회 4,344
11-12-06 조회 5,687
11-12-06 조회 3,743
11-12-06 조회 3,673
11-12-05 조회 3,090
11-12-05 조회 3,387
11-12-05 조회 4,619
11-12-05 조회 3,365
11-12-05 조회 4,977
11-12-05 조회 2,926
11-12-05 조회 6,001
11-12-05 조회 3,124
11-12-05 조회 4,453
11-12-04 조회 5,770
11-12-04 조회 3,014
11-12-04 조회 3,379
11-12-03 조회 3,690
11-12-03 조회 3,053
11-12-03 조회 3,646
11-12-03 조회 3,550