php判断远程文件是否存在php
function check_file_exists($file){
if(strtolower(substr($file, 0, 4))=='http'){ //远程文件
$header = get_headers($file, true);
return isset($header[0]) &&am...
function check_file_exists($file){
if(strtolower(substr($file, 0, 4))=='http'){ //远程文件
$header = get_headers($file, true);
return isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304'));
}else{ //本地文件
return file_exists($file);
}
}
if(strtolower(substr($file, 0, 4))=='http'){ //远程文件
$header = get_headers($file, true);
return isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304'));
}else{ //本地文件
return file_exists($file);
}
}
最新评论
热门推荐
我要评论