명

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-11 조회 3,187
12-02-11 조회 3,076
12-02-11 조회 3,513
12-02-10 조회 1만
12-02-10 조회 3,670
12-02-10 조회 4,633
12-02-09 조회 4,003
12-02-09 조회 3,562
12-02-09 조회 6,499
12-02-09 조회 3,213
12-02-08 조회 3,657
12-02-08 조회 3,058
12-02-08 조회 3,118
12-02-08 조회 4,067
12-02-08 조회 4,778
12-02-08 조회 3,113
12-02-07 조회 3,441
12-02-07 조회 3,375
12-02-07 조회 3,383
12-02-07 조회 2,687
12-02-07 조회 3,431
12-02-07 조회 2,977
12-02-06 조회 3,156
12-02-06 조회 3,049
12-02-06 조회 3,611
12-02-06 조회 4,050
12-02-06 조회 3,396
12-02-06 조회 1.2만
12-02-06 조회 4,327
12-02-06 조회 5,772
12-02-05 조회 2,856
12-02-05 조회 3,633
12-02-05 조회 3,037
12-02-04 조회 2,957
12-02-04 조회 2,951
12-02-04 조회 6,781
12-02-03 조회 3,956
12-02-03 조회 4,346
12-02-03 조회 2,848
12-02-03 조회 3,390
12-02-03 조회 3,978
12-02-02 조회 3,014
12-02-02 조회 3,787
12-02-02 조회 3,819
12-02-02 조회 5,486
12-02-02 조회 3,441
12-02-02 조회 4,703
12-02-02 조회 3,553
12-02-01 조회 3,385
12-02-01 조회 3,627
12-02-01 조회 4,055
12-02-01 조회 3,343
12-02-01 조회 2,891
12-01-31 조회 3,315
12-01-31 조회 3,564
12-01-31 조회 2,967
12-01-30 조회 9,737
12-01-30 조회 8,905
12-01-30 조회 2,881
12-01-30 조회 3,296
12-01-30 조회 3,385
12-01-30 조회 2,894
12-01-30 조회 3,061
12-01-29 조회 3,385
12-01-29 조회 3,250
12-01-29 조회 4,713
12-01-29 조회 2,893
12-01-29 조회 3,603
12-01-29 조회 3,894
12-01-28 조회 3,516
12-01-28 조회 2,749
12-01-28 조회 3,563
12-01-27 조회 2,952
12-01-27 조회 2,866
12-01-27 조회 2,911
12-01-27 조회 3,358
12-01-26 조회 6,651
12-01-26 조회 3,713
12-01-26 조회 3,496
12-01-26 조회 3,029
12-01-26 조회 3,125
12-01-25 조회 3,200
12-01-25 조회 3,005
12-01-25 조회 2,873
12-01-25 조회 2,681
12-01-25 조회 2,549
12-01-25 조회 4,282
12-01-25 조회 4,149
12-01-25 조회 2,756
12-01-25 조회 4,114
12-01-25 조회 3,590
12-01-24 조회 3,304
12-01-24 조회 3,508
12-01-24 조회 3,724
12-01-24 조회 4,435
12-01-22 조회 3,521
12-01-22 조회 2,865
12-01-22 조회 3,276
12-01-22 조회 3,773
12-01-21 조회 3,123