명

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,188건
+
제목 글쓴이 날짜 조회
12-08-29 조회 5,617
12-08-21 조회 3,576
12-08-21 조회 3,669
12-08-05 조회 3,595
12-08-04 조회 4,585
12-07-31 조회 9,478
12-07-26 조회 3,983
12-07-24 조회 3,601
12-07-20 조회 3,644
12-07-15 조회 3,583
12-07-09 조회 4,826
12-07-09 조회 3,511
12-07-09 조회 3,391
12-07-06 조회 4,259
12-07-05 조회 3,364
12-07-05 조회 3,419
12-06-30 조회 3,526
12-06-29 조회 3,319
12-06-26 조회 3,559
12-06-18 조회 3,440
12-06-18 조회 3,575
12-05-31 조회 3,693
12-05-29 조회 4,461
12-05-23 조회 3,552
12-05-22 조회 3,855
12-05-17 조회 4,741
12-05-10 조회 3,584
12-05-06 조회 3,468
12-05-04 조회 3,129
12-04-25 조회 3,643
12-04-21 조회 3,156
12-04-21 조회 4,534
12-04-20 조회 3,619
12-04-10 조회 3,107
12-04-06 조회 2,964
12-04-05 조회 3,305
12-04-05 조회 3,987
12-03-31 조회 3,127
12-03-30 조회 3,189
12-03-29 조회 3,085
12-03-28 조회 3,113
12-03-27 조회 3,429
12-03-26 조회 3,798
12-03-23 조회 3,012
12-03-20 조회 3,067
12-03-12 조회 3,023
12-03-12 조회 3,331
12-03-12 조회 3,230
12-03-12 조회 4,175
12-03-12 조회 5,800
12-03-12 조회 3,781
12-03-12 조회 5,588
12-03-12 조회 3,809
12-03-12 조회 6,207
12-03-06 조회 3,136
12-03-04 조회 4,280
12-03-02 조회 4,185
12-02-16 조회 5,273
12-02-15 조회 4,731
12-02-11 조회 3,096
12-02-08 조회 2,959
12-02-08 조회 3,978
12-02-07 조회 3,363
12-01-30 조회 3,217
12-01-29 조회 3,513
12-01-25 조회 3,495
12-01-19 조회 3,126
12-01-12 조회 3,150
11-12-30 조회 3,778
11-12-29 조회 3,174
11-12-26 조회 3,183
11-12-26 조회 3,092
11-12-17 조회 4,200
11-12-17 조회 3,493
11-12-01 조회 3,146
11-11-19 조회 4,328
11-11-14 조회 4,202
11-11-14 조회 2,802
11-11-10 조회 3,029
11-11-10 조회 3,698
11-10-27 조회 2,581
11-10-26 조회 2,667
11-10-25 조회 2,586
11-10-17 조회 3,767
11-10-10 조회 2,637
11-10-03 조회 2,697
11-09-28 조회 2,543
11-09-28 조회 4,048
11-09-26 조회 2,529
11-09-26 조회 2,649
11-09-25 조회 2,992
11-09-19 조회 6,123
11-09-09 조회 3,068
11-09-08 조회 3,390
11-08-31 조회 3,204
11-08-29 조회 5,170
11-08-25 조회 2,857
11-08-23 조회 2,539
11-08-21 조회 2,563
11-08-19 조회 2,465