我想了一下,好像fscokopen可以判断返回的http头中有200没有刚刚网上也查了下,asp 的也是这个原理 <%
Function IsExi(url)
On Error Resume Next
IsExi= False
Set x = Server.CreateObject("Microsoft.xmlhttp")
x.Open "HEAD",url,false
x.send
IsExi= (x.status = 200)
End FunctionResponse.Write IsExi("http://xxx.com/xxx.zip")%>

解决方案 »

  1.   

    我一直用@fopen(),貌似也可以
      

  2.   

    function is_file_exists($fileName)
    {
    $handle = @fopen($fileName,"r");
    if ($handle)
    return true;
    else
    return false;
    }        测试通过了
      

  3.   

    if (file($url))
    {
      echo "Y";
    }else{
      echo "N";
    }
      

  4.   

    用file如果文件不存在
    或者网络不好
    或者文件过大
    就会造成当前页卡死现象
      

  5.   

    if(is_file($url))
        echo "y";
    else
        echo "b";
      

  6.   

    找到解决方法了:If you need fopen() on a URL to timeout, you can do like:
    <?php
      $timeout = 3;
      $old = ini_set('default_socket_timeout', $timeout);
      $file = fopen('http://example.com', 'r');
      ini_set('default_socket_timeout', $old);
      stream_set_timeout($file, $timeout);
      stream_set_blocking($file, 0);
      //the rest is standard
    ?>