반응형
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 curl_unescape — 지정된 URL 인코딩 된 문자열을 디코딩합니다. (0) | 2016.12.23 |
---|---|
php curl_escape — 주어진 문자열을 URL 인코딩합니다. (0) | 2016.12.23 |
php setrawcookie — 쿠키 값을 urlencoding하지 않고 쿠키 보내기 (0) | 2016.12.21 |
php header — HTTP 헤더 보내기 (0) | 2016.12.19 |
php headers_sent — 헤더가 전송되었는지 여부를 확인합니다. (0) | 2016.12.19 |