Home > Article > Backend Development > Example sharing of PHP determining the existence of remote files
How does PHP determine whether a remote file exists? This article mainly introduces the method of PHP to determine whether network files exist. It analyzes the skills of PHP to read network files with examples. I hope it will be helpful to everyone.
The example in this article describes how PHP determines whether a network file exists. Share it with everyone for your reference. The specific implementation method is as follows:
$file = "http://www.php.cn/demo/file_exists.zip"; $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."; }
Related recommendations:
Detailed explanation of php file reading series methods
php File splitting and merging (resumable upload)
php File upload A brief introduction to the principle
The above is the detailed content of Example sharing of PHP determining the existence of remote files. For more information, please follow other related articles on the PHP Chinese website!