명

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-01-08 조회 3,059
12-01-07 조회 3,664
12-01-07 조회 3,121
12-01-07 조회 3,029
12-01-07 조회 2,998
12-01-07 조회 5,252
12-01-06 조회 2,780
12-01-06 조회 3,494
12-01-06 조회 2,984
12-01-06 조회 2,938
12-01-06 조회 2,943
12-01-06 조회 5,649
12-01-06 조회 3,697
12-01-06 조회 2,892
12-01-06 조회 3,019
12-01-05 조회 3,080
12-01-05 조회 3,095
12-01-05 조회 2,805
12-01-05 조회 2,902
12-01-05 조회 3,549
12-01-05 조회 5,394
12-01-04 조회 3,839
12-01-04 조회 2,833
12-01-04 조회 2,777
12-01-04 조회 2,998
12-01-04 조회 2,838
12-01-04 조회 2,918
12-01-04 조회 3,075
12-01-04 조회 2,831
12-01-04 조회 5,241
12-01-04 조회 5,110
12-01-04 조회 2,969
12-01-04 조회 3,434
12-01-04 조회 3,108
12-01-04 조회 2,930
12-01-04 조회 5,427
12-01-04 조회 4,596
12-01-04 조회 4,081
12-01-04 조회 3,948
12-01-04 조회 2,774
12-01-03 조회 3,663
12-01-03 조회 2,643
12-01-03 조회 2,667
12-01-03 조회 2,670
12-01-02 조회 3,165
12-01-02 조회 3,222
12-01-02 조회 4,066
12-01-02 조회 3,035
12-01-02 조회 3,252
12-01-02 조회 3,516
12-01-02 조회 3,515
12-01-01 조회 2,716
12-01-01 조회 4,192
12-01-01 조회 3,162
12-01-01 조회 3,536
11-12-31 조회 3,473
11-12-31 조회 3,805
11-12-31 조회 3,906
11-12-31 조회 3,142
11-12-31 조회 3,293
11-12-31 조회 3,730
11-12-30 조회 3,986
11-12-30 조회 3,267
11-12-30 조회 3,323
11-12-30 조회 3,968
11-12-30 조회 5,153
11-12-30 조회 4,255
11-12-30 조회 4,426
11-12-30 조회 3,889
11-12-30 조회 3,609
11-12-30 조회 3,630
11-12-30 조회 3,475
11-12-30 조회 2,670
11-12-30 조회 3,837
11-12-30 조회 7,112
11-12-29 조회 3,683
11-12-29 조회 3,366
11-12-29 조회 3,031
11-12-29 조회 3,248
11-12-29 조회 3,104
11-12-28 조회 2,728
11-12-28 조회 2,875
11-12-28 조회 3,007
11-12-28 조회 2,932
11-12-28 조회 3,795
11-12-27 조회 3,152
11-12-27 조회 2,918
11-12-27 조회 2,822
11-12-27 조회 2,936
11-12-26 조회 3,258
11-12-26 조회 3,157
11-12-26 조회 3,734
11-12-26 조회 3,367
11-12-26 조회 5,923
11-12-25 조회 3,090
11-12-23 조회 3,642
11-12-23 조회 3,585
11-12-23 조회 5,160
11-12-23 조회 4,816
11-12-23 조회 2,904