本文實例講述了PHP判斷網絡文件是否存在的方法。分享給大家供大家參考。具體實現方法如下:
$file = "http://www.jb51.net/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.";
}
希望本文所述對大家的php程序設計有所幫助。