PHP判断网络文件是否存在的方法

前端之家收集整理的这篇文章主要介绍了PHP判断网络文件是否存在的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_502_0@本文实例讲述了PHP判断网络文件是否存在的方法分享给大家供大家参考。具体实现方法如下:


<div class="jb51code">
<pre class="brush:PHP;">
$file = "//www.jb51.cc/demo/file_exists.zip";
$fileExists = @file_get_contents($file,null,-1,1) ? true : false;
if($fileExists){
echo "File Exists!";
}else{
echo "Sorry,we couldn't find the file.";
}

@H_502_0@希望本文所述对大家的PHP程序设计有所帮助。

猜你在找的PHP相关文章