W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
作用:將原生的頭部信息解析為關(guān)聯(lián)數(shù)組。
語法: array parse_header(string $header_str)
參數(shù):
$header_str
頭部信息字符串。返回值:
示例:
<?php
$header = 'HTTP/1.1 200 OK
Date: Wed, 28 Sep 2016 04:46:33 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.16
X-Powered-By: PHP/5.4.16
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8';
print_r(parse_header($header));
/** 將輸出如下
Array
(
[0] => HTTP/1.1 200 OK
[Date] => Wed, 28 Sep 2016 04:46:33 GMT
[Server] => Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.4.16
[X-Powered-By] => PHP/5.4.16
[Expires] => Thu, 19 Nov 1981 08:52:00 GMT
[Cache-Control] => no-store, no-cache, must-revalidate, post-check=0, pre-check=0
[Pragma] => no-cache
[Keep-Alive] => timeout=5, max=100
[Connection] => Keep-Alive
[Transfer-Encoding] => chunked
[Content-Type] => text/html; charset=UTF-8
)
*/
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: