function getHeaders($url,$timeout=2)
{
$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,$timeout);
$data=curl_exec($ch);
curl_close($ch);
if(empty($data)) return false;
$headers=explode("\n",$data);
foreach ($headers as $key=>$headerLine){
if(strlen($headerLine)>1){
if(strpos($headerLine,':')!==false) $headers[stristr($headerLine,':',true)]=trim(stristr($headerLine,':'),': ');
}else{
unset($headers[$key]);
}
}
return $headers;
}Array
(
[0] => HTTP/1.1 200 OK
[1] => Server: NWS_UGC_HY
[2] => Connection: keep-alive
[3] => Date: Tue, 14 Jun 2016 13:27:28 GMT
[4] => Cache-Control: max-age=600
[5] => Expires: Tue, 14 Jun 2016 13:37:28 GMT
[6] => Last-Modified: Sun, 03 Aug 2014 22:52:31 GMT
[7] => Content-Type: application/octet-stream
[8] => Content-Length: 102752
[9] => X-Cache-Lookup: Hit From Disktank
[Server] => NWS_UGC_HY
[Connection] => keep-alive
[Date] => Tue, 14 Jun 2016 13:27:28 GMT
[Cache-Control] => max-age=600
[Expires] => Tue, 14 Jun 2016 13:37:28 GMT
[Last-Modified] => Sun, 03 Aug 2014 22:52:31 GMT
[Content-Type] => application/octet-stream
[Content-Length] => 102752
[X-Cache-Lookup] => Hit From Disktank
)
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号