명

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-11-16 조회 3,470
11-11-15 조회 2,579
11-11-15 조회 3,195
11-11-15 조회 2,643
11-11-14 조회 2,737
11-11-14 조회 3,694
11-11-14 조회 3,484
11-11-14 조회 4,162
11-11-14 조회 2,774
11-11-14 조회 2,686
11-11-13 조회 3,980
11-11-12 조회 2,624
11-11-12 조회 2,746
11-11-12 조회 3,965
11-11-11 조회 2,876
11-11-11 조회 2,824
11-11-11 조회 2,502
11-11-11 조회 2,813
11-11-11 조회 3,948
11-11-11 조회 2,415
11-11-11 조회 4,652
11-11-11 조회 2,687
11-11-11 조회 2,514
11-11-11 조회 2,384
11-11-11 조회 2,805
11-11-11 조회 2,589
11-11-11 조회 2,578
11-11-10 조회 3,005
11-11-10 조회 2,481
11-11-10 조회 3,114
11-11-10 조회 3,669
11-11-10 조회 2,375
11-11-10 조회 2,508
11-11-10 조회 2,339
11-11-09 조회 2,527
11-11-09 조회 3,223
11-11-09 조회 2,712
11-11-09 조회 2,857
11-11-08 조회 2,616
11-11-08 조회 2,940
11-11-08 조회 2,275
11-11-08 조회 3,230
11-11-08 조회 2,517
11-11-08 조회 3,297
11-11-06 조회 1만
11-11-06 조회 2,582
11-11-06 조회 3,574
11-11-06 조회 3,382
11-11-06 조회 3,690
11-11-06 조회 3,876
11-11-05 조회 2,421
11-11-05 조회 2,588
11-11-04 조회 8,473
11-11-04 조회 2,539
11-11-04 조회 2,597
11-11-04 조회 3,600
11-11-04 조회 2,494
11-11-04 조회 2,667
11-11-03 조회 3,929
11-11-03 조회 2,600
11-11-03 조회 5,562
11-11-02 조회 5,836
11-11-01 조회 3,111
11-11-01 조회 2,550
11-11-01 조회 3,169
11-11-01 조회 2,466
11-11-01 조회 2,802
11-11-01 조회 2,323
11-11-01 조회 9,348
11-11-01 조회 2,910
11-10-31 조회 2,296
11-10-27 조회 2,545
11-10-26 조회 3,141
11-10-26 조회 2,629
11-10-26 조회 2,490
11-10-26 조회 2,519
11-10-26 조회 2,407
11-10-25 조회 2,461
11-10-25 조회 2,547
11-10-25 조회 2,493
11-10-25 조회 2,475
11-10-24 조회 2,513
11-10-24 조회 2,773
11-10-24 조회 2,784
11-10-23 조회 3,145
11-10-23 조회 2,735
11-10-23 조회 2,629
11-10-21 조회 2,486
11-10-21 조회 2,417
11-10-21 조회 2,390
11-10-21 조회 2,772
11-10-20 조회 3,972
11-10-19 조회 2,452
11-10-19 조회 2,845
11-10-19 조회 3,968
11-10-19 조회 3,110
11-10-19 조회 2,824
11-10-19 조회 6,651
11-10-18 조회 3,987
11-10-18 조회 2,560