-1

标准的 get_headers 函数有多种格式

get_headers($url);
get_headers($url,1);

我使用 curl 设置请求的超时,所以这是我的功能

function get_headers_curl($url)
{
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,            $url);
curl_setopt($ch, CURLOPT_HEADER,        true);
curl_setopt($ch, CURLOPT_NOBODY,         true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,       3);

$r = curl_exec($ch);
$r = split("\n", $r);
return $r;
} 

我努力了

get_headers_curl($url,1)

没有结果

所以请告诉我如何制作第二种格式

get_headers($url,1)

此致

4

1 回答 1

0

尝试使用该 curl_getinfo() 功能。

于 2012-07-17T14:20:44.363 回答