<?php
function getFileSize($url){
        $url = parse_url($url);
        if($fp = fsockopen($url['host'],empty($url['port'])?80:$url['port'],$error))
  {
                fputs($fp,"GET ".(empty($url['path'])?'/':$url['path'])." HTTP/1.1\r\n");
                fputs($fp,"Host:$url[host]\r\n\r\n");
                while(!feof($fp))
    {
                 $tmp = fgets($fp);
                    if(trim($tmp) == '')
     {
                        break;
                    }elseif(preg_match('/Content-Length:(.*)/si',$tmp,$arr))
     {
                     return trim($arr[1]);
                     }
                }
                return null;
        }else
  {
         return null;
        }
}
echo  getFileSize("http://192.168.1.2/chinaz.rar");//这样能返回文件大小
echo  getFileSize("http://192.168.1.2/中国.rar");//但是这样就不行。
?>
这样就能返回文件的大小。但是如果文件的名称是中文的就不能返回文件的大小呢?为什么呢?希望各位高手能帮忙解答