PHP 헤더 함수 상세 설명

1583 단어 PHPheader
PHP 의 header 함 수 는 클 라 이언 트 에 HTTP 헤더 정 보 를 보 내 는 데 가장 많이 사용 되 는 함수 중 하나 입 니 다.
인 코딩 설정,HTTP 상태 값 보 내기,방향 바 꾸 기 등 을 사용 합 니 다.
php header utf8 :
header(“Content-type: text/html; charset=utf-8″);
php header 404 :
header(“HTTP/1.0 404 Not Found”);
이 두 가지 예 는 UTF 8 인 코딩 설정 과 404 상태 발송 이다.
헤더 재 설정:
header(‘Location: http://www.phpthinking.com');
기타 자주 사용 하 는 Header 사용법:
//Header 는 영구적 으로 방향 을 바 꾸 고 보통 301 은 header Location 와 함께 사용 합 니 다.

header(‘HTTP/1.1 301 Moved Permanently');
header(‘Location: http://www.phpthinking.com/');
//헤더 가 지연 되 어 페이지 를 새로 고 칩 니 다.

// HTML    <meta http-equiv=”refresh” content=”10;http://www.phpthinking.com” />    
header(‘Refresh: 10; url=http://www.phpthinking.com/');
//헤더 설정 페이지 언어

header(‘Content-language: en');
//다운로드 페이지 에 대해 파일 형식 과 파일 이름 을 설명 할 수 있 습 니 다.

header(‘Content-Type: application/octet-stream');
header(‘Content-Disposition: attachment; filename=”filename.zip”‘);
header(‘Content-Transfer-Encoding: binary');
//헤더 설정 캐 시 와 캐 시 만 료 시간

header(‘Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//헤더 설정 페이지 인 코딩:

header(‘Content-Type: text/html; charset=utf-8′);
여기 서 PHP 의 header 함수 에 대한 상세 한 설명 을 소개 합 니 다.더 많은 PHP 의 header 함수 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 많은 응원 바 랍 니 다!

좋은 웹페이지 즐겨찾기