명

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건
+
제목 글쓴이 날짜 조회
13-03-03 조회 6,297
13-03-01 조회 5,623
13-03-01 조회 8,368
13-03-01 조회 6,375
13-02-26 조회 3,984
13-02-26 조회 3,933
13-02-26 조회 4,823
13-02-24 조회 8,206
13-02-24 조회 4,307
13-02-24 조회 3,550
13-02-24 조회 5,359
13-02-24 조회 5,345
13-02-24 조회 4,412
13-02-24 조회 5,742
13-02-24 조회 9,440
13-02-14 조회 5,188
13-02-13 조회 9,124
13-01-29 조회 7,740
13-01-24 조회 5,085
13-01-24 조회 4,966
13-01-17 조회 4,382
13-01-16 조회 4,424
13-01-08 조회 4,433
12-12-27 조회 4,136
12-12-20 조회 1.1만
12-12-20 조회 3,432
12-12-06 조회 4,452
12-12-01 조회 4,208
12-11-28 조회 5,788
12-11-25 조회 5,487
12-10-20 조회 4,715
12-10-03 조회 4,888
12-09-26 조회 5,029
12-09-15 조회 8,470
12-09-14 조회 5,484
12-09-11 조회 4,008
12-09-10 조회 3,998
12-09-05 조회 8,895
12-08-29 조회 4,725
12-08-26 조회 3,846
12-08-23 조회 3,551
12-08-22 조회 3,626
12-08-22 조회 4,439
12-08-21 조회 3,574
12-08-20 조회 3,507
12-08-20 조회 9,313
12-08-15 조회 4,437
12-08-13 조회 3,347
12-08-11 조회 4,757
12-08-05 조회 4,629
12-08-03 조회 3,396
12-08-03 조회 4,094
12-08-02 조회 5,084
12-07-29 조회 4,194
12-07-26 조회 3,761
12-07-26 조회 3,622
12-07-22 조회 3,550
12-07-20 조회 3,373
12-07-19 조회 4,244
12-07-19 조회 3,512
12-07-16 조회 3,619
12-07-16 조회 4,534
12-07-15 조회 3,630
12-07-12 조회 7,432
12-07-12 조회 5,082
12-07-11 조회 3,129
12-07-09 조회 3,288
12-07-05 조회 3,895
12-07-04 조회 4,476
12-07-04 조회 3,895
12-07-04 조회 4,412
12-06-29 조회 3,873
12-06-27 조회 3,472
12-06-24 조회 3,937
12-06-22 조회 4,258
12-06-22 조회 8,667
12-06-22 조회 3,312
12-06-21 조회 3,331
12-06-17 조회 3,983
12-06-14 조회 4,076
12-06-14 조회 3,359
12-06-08 조회 4,490
12-06-06 조회 3,450
12-06-04 조회 4,229
12-05-26 조회 5,031
12-05-26 조회 3,981
12-05-25 조회 3,270
12-05-24 조회 3,373
12-05-22 조회 3,429
12-05-20 조회 3,073
12-05-16 조회 3,180
12-05-15 조회 3,564
12-05-10 조회 3,992
12-05-08 조회 3,542
12-05-04 조회 3,378
12-05-03 조회 4,332
12-05-02 조회 3,471
12-05-02 조회 3,243
12-05-02 조회 3,341
12-04-26 조회 3,505