PHP의 headers_list () 함수
정의 및 사용
headers_list () 함수 반환 송신 (또는 송신 할) 헤드의리스트에 응답.
이 함수는 헤더를 포함하는 배열을 반환합니다.
문법
headers_list()
팁과주의 사항
팁 : 전송 헤더 여부, 사용 headers_sent () 함수를 결정합니다.
예 1
<?php
setcookie("TestCookie","SomeValue"');
header("X-Sample-Test: foo");
header('Content-type: text/plain');
?>
<html>
<body>
<?php
// What headers are to be sent?
var_dump(headers_list());
?>
</body>
</html>
setcookie("TestCookie","SomeValue"');
header("X-Sample-Test: foo");
header('Content-type: text/plain');
?>
<html>
<body>
<?php
// What headers are to be sent?
var_dump(headers_list());
?>
</body>
</html>
가 출력 위의 코드 :
array(4)
{
[0]=> string(23) "X-Powered-By: PHP/5.1.1"
[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"
[2]=> string(18) "X-Sample-Test: foo"
[3]=> string(24) "Content-type: text/plain"
}
{
[0]=> string(23) "X-Powered-By: PHP/5.1.1"
[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"
[2]=> string(18) "X-Sample-Test: foo"
[3]=> string(24) "Content-type: text/plain"
}
전체 PHP HTTP 참조 설명서