找到啦,以下摘自php.net For file_exists command:I have found a quick fast non-fuss way to help you to check if an image file exists via HTTP:$image_info = @getimagesize("http://$filelocation/$filename"); $type=$image_info[2]; if ($type == 0) { echo "file doesnt exists"; } else { echo "the file exists"; }
For file_exists command:I have found a quick fast non-fuss way to help you to check if an image file exists via HTTP:$image_info = @getimagesize("http://$filelocation/$filename");
$type=$image_info[2];
if ($type == 0) {
echo "file doesnt exists";
} else {
echo "the file exists";
}
不过如果没有扩展名的话只好看文件的magic值了
呵呵
$len=strlen($file_name);
$aa=substr($file_name,$len-4,4);
//取出的$aa就是扩展名了,至于如何if好办了
?>