本文介绍了PHP通配符,在目录中搜索文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
标题说明得差不多.我有一个目录,其中存储了图像.我使用PHP glob()函数.代码如下:
Hello,
The title explains it pretty much. I''ve a directory with images stored in it. I use the PHP glob() function. Here''e the code:
$dir = '../images/';
foreach(glob($dir. "[". $_GET['ID']. "]". *. '.jpg') as $file) {
print $file . "\n";
}
我希望列出所有以特定字符开头的文件,例如2.但是,我必须保持动态.我的意思是我必须保留$ _GET [''ID''].而且我仍然要列出所有以该ID开头的文件.
我怎么做?请不要直接参考一些间接教程,请直接帮助我.
感激!
谢谢!
I want to be ale to list all the files that begin with a specific character, 2 as example. But, I''ve to keep it dynamic. I mean I''ve to keep the $_GET[''ID'']. And still I want to list all the files that begin with this ID.
How do I do that? Please, rather than referring some to some indirect tutorials, please help me directly.
Appreciated!
Thanks!
推荐答案
这篇关于PHP通配符,在目录中搜索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!