Heim  >  Artikel  >  Backend-Entwicklung  >  PHP判断网络文件是否存在

PHP判断网络文件是否存在

WBOY
WBOYOriginal
2016-07-25 08:42:101224Durchsuche

[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


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn