如何在不知道文件格式php的情况下检查文件名是否存在 [英] How to check if file name exist without know the file format php
本文介绍了如何在不知道文件格式php的情况下检查文件名是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if(file_exists("/img/korica/Design_1.*"))
echo "file exist";
else
echo "there are no files with that name"
推荐答案
您只需要使用 :glob()
:
You just need to use :glob()
:
$existence= glob("./Yourdir/filename.*");
然后检查 $ existence
是否有东西!
它也可以与类似
It can also be used with a bash-like
brace expansion:
glob("./uploads/filename.{jpg,jpeg,png,gif}", GLOB_BRACE).
这篇关于如何在不知道文件格式php的情况下检查文件名是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文