명

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건
+
제목 글쓴이 날짜 조회
11-10-25 조회 2,500
11-10-18 조회 4,029
11-10-18 조회 2,406
11-10-15 조회 3,633
11-10-10 조회 2,680
11-10-02 조회 2,593
11-09-28 조회 2,414
11-09-24 조회 2,506
11-09-22 조회 2,396
11-09-05 조회 2,881
11-08-31 조회 2,257
11-08-31 조회 2,571
11-08-31 조회 2,423
11-08-29 조회 2,970
11-08-28 조회 2,466
11-08-25 조회 2,521
11-08-17 조회 2,234
11-08-16 조회 2,468
11-08-11 조회 2,924
11-08-07 조회 2,637
11-08-03 조회 2,348
11-07-22 조회 2,089
11-07-12 조회 3,308
11-06-27 조회 2,091
11-06-01 조회 1,756
11-05-17 조회 2,541
11-05-01 조회 2,613
11-04-28 조회 2,901
11-04-28 조회 2,953
11-04-13 조회 2,608
11-03-27 조회 2,732
11-03-27 조회 2,608
11-03-14 조회 2,023
11-03-02 조회 2,350
11-03-02 조회 2,579
11-02-27 조회 3,004
11-02-23 조회 2,387
11-02-19 조회 2,526
11-02-14 조회 4,139
11-02-03 조회 2,931
11-01-24 조회 3,880
11-01-04 조회 2,407
10-12-08 조회 5,420
10-11-15 조회 2,428
10-11-14 조회 2,614
10-11-14 조회 3,625
10-10-29 조회 3,694
10-10-19 조회 2,709
10-10-07 조회 2,534
10-10-05 조회 4,451
10-09-18 조회 2,747
10-09-18 조회 2,487
10-09-17 조회 4,893
10-09-15 조회 2,833
10-09-15 조회 2,361
10-09-15 조회 2,853
10-09-15 조회 2,685
10-09-11 조회 4,009
10-09-11 조회 2,514
10-09-11 조회 2,550
10-09-07 조회 3,826
10-09-07 조회 3,365
10-08-29 조회 2,824
10-07-01 조회 3,070
10-06-30 조회 2,477
10-06-30 조회 2,657
10-06-30 조회 3,010
10-06-13 조회 2,044
10-04-15 조회 3,218
10-04-04 조회 3,450
10-02-23 조회 3,551
10-02-09 조회 3,152
10-01-25 조회 2,662
10-01-25 조회 2,758
09-12-27 조회 4,403
09-11-23 조회 3,627
09-11-20 조회 4,862
09-08-30 조회 3,057
09-08-30 조회 3,052
09-08-12 조회 3,024
09-07-22 조회 4,081
09-07-22 조회 4,728
09-07-15 조회 5,897
09-07-11 조회 2,972
09-06-17 조회 2,716
09-06-15 조회 3,005
09-05-29 조회 3,281
09-05-11 조회 5,915
09-05-08 조회 2,674
09-04-30 조회 3,791
09-04-17 조회 3,111
09-04-04 조회 3,294
09-03-05 조회 3,675
09-02-09 조회 3,644
09-02-03 조회 6,148
08-12-27 조회 3,214
08-12-20 조회 4,301
08-11-21 조회 5,263
08-11-14 조회 2,832
08-11-03 조회 3,296