0
$ch = curl_init();
$url = "https://ttr.test.ru/";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER, 1);
$result = curl_exec($ch);
curl_close($ch);
curl
返回下一個文本(頭):Curl返回標題 - 如何獲取值標題?
HTTP/1.1 202 Test
Access-Control-Headers: X-PHP-TEST-1, X-PHP-TEST-2, X-PHP-TEST-3
Content-Type: text/plain; charset=utf-8
X-PHP-TEST-1: a43edefa03d32ee8a5183a0662bb82e6
X-PHP-TEST-2: 85628
X-PHP-TEST-3: 2434234234
Date: Mon, 01 Aug 2016 01:03:25 GMT
如何獲得價值HTTP/1.1
(202),X-PHP-TEST-1
,X-PHP-TEST-2
和X-PHP-TEST-3
?
http://stackoverflow.com/questions/10589889/returning-header-as -array-using-curl – Ghost
@Ghost php對此沒有標準功能? –
你需要捲起自己的 – Ghost