PHP判斷網(wǎng)絡(luò)文件是否存在的方法

字號:


    這篇文章主要介紹了PHP判斷網(wǎng)絡(luò)文件是否存在的方法,實(shí)例分析了php讀取網(wǎng)絡(luò)文件的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    本文實(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.";
    }
    希望本文所述對大家的php程序設(shè)計(jì)有所幫助。