PHP判断网络文件是否存在

[PHP]代码

$file = "http://www.xxx.nxxxet/demo/file_exists.zip";
$fileExists = @file_get_contents($file,null,null,-1,1) ? true : false ;

if($fileExists){
     echo "File Exists!";
}else{
     echo "Sorry, we couldn't find the file.";
}

编程技巧