반응형
headers_list — 보내진 (또는 보낼 준비가 된) 응답 헤더 목록을 반환합니다.
설명 :
array headers_list ( void )
headers_list ()는 브라우저 / 클라이언트에 보낼 헤더 목록을 반환합니다. 이 헤더가 아직 전송되었는지 여부를 확인하려면 headers_sent ()를 사용하십시오.
반환값 :
헤더로 수치 적으로 배열 된 배열을 반환합니다.
예제 :
<?php
/* setcookie() will add a response header on its own */
setcookie('foo', 'bar');
/* Define a custom response header
This will be ignored by most clients */
header("X-Sample-Test: foo");
/* Specify plain text content in our response */
header('Content-type: text/plain');
/* What headers are going to be sent? */
var_dump(headers_list());
?>
위 예제의 출력:
array(4) {
[0]=>
string(23) "X-Powered-By: PHP/5.1.3"
[1]=>
string(19) "Set-Cookie: foo=bar"
[2]=>
string(18) "X-Sample-Test: foo"
[3]=>
string(24) "Content-type: text/plain"
}
반응형
'IT > php' 카테고리의 다른 글
php http_build_query — URL 인코드한 쿼리 문자열 생성 (0) | 2016.12.28 |
---|---|
php http_response_code — HTTP 응답 코드 가져 오기 또는 설정 (0) | 2016.12.27 |
php header_remove — 이전에 설정된 머리글 제거 (0) | 2016.12.27 |
php urlencode — 문자열을 URL 인코드 (0) | 2016.12.23 |
php curl_unescape — 지정된 URL 인코딩 된 문자열을 디코딩합니다. (0) | 2016.12.23 |