Home  >  Article  >  Backend Development  >  PHP determines whether a network file exists

PHP determines whether a network file exists

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

[PHP] code

  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. }
Copy code
Does it exist, PHP


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn