首頁  >  文章  >  後端開發  >  PHP判断网络文件是否存在

PHP判断网络文件是否存在

WBOY
WBOY原創
2016-07-25 08:42:101224瀏覽

[PHP]代码

  1. $file = "http://www.xxx.nxxxet/demo/file_exists.zip";
  2. $fileExists = @file_get_contents($file,null,null,-1,1) ? true : false ;
  3. if($fileExists){
  4. echo "File Exists!";
  5. }else{
  6. echo "Sorry, we couldn't find the file.";
  7. }
复制代码
是否存在, PHP


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn