headers_list — 보내진 (또는 보낼 준비가 된) 응답 헤더 목록을 반환합니다. > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

headers_list — 보내진 (또는 보낼 준비가 된) 응답 헤더 목록을 반환합니다. 정보

PHP headers_list — 보내진 (또는 보낼 준비가 된) 응답 헤더 목록을 반환합니다.

본문

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"

}


추천
2
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로