這篇文章主要介紹了PHP判斷網(wǎng)絡(luò)文件是否存在的方法,實(shí)例分析了php讀取網(wǎng)絡(luò)文件的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了PHP判斷網(wǎng)絡(luò)文件是否存在的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
$file = "";
$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.";
}
希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。
更多信息請(qǐng)查看IT技術(shù)專欄