Example sharing of PHP determining the existence of remote files

*文
Release: 2023-03-18 12:28:02
Original
1395 people have browsed it

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 = "//m.sbmmt.com/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.";
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!