在本地建立books/yizhuqingtian.txt目录
编写PHP文件:
<?php
$url = "http://localhost/books/yizhuqingtian.txt";
echo $url;
echo "</br>";
print_r(get_headers($url,true));
?>
运行得到
Array (
[0] => HTTP/1.1 200 OK
[Date] => Mon, 09 Mar 2015 14:51:25 GMT
[Server] => Apache/2.0.63 (Win32) PHP/5.2.14
[Last-Modified] => Sun, 08 Feb 2015 14:56:10 GMT
[ETag] => "138db-3915c0-daad97c9"
[Accept-Ranges] => bytes
[Content-Length] => 3741120
[Connection] => close
[Content-Type] => text/plain
)
其中Content-Length字段指明了文件长度