经测试代码如下:
/**
* 通过glob查找指定的文件
*
* @param
* @arrange (编程之家) jb51.cc
**/
$dir = './';
foreach(glob($dir.'*.txt') as $file) {
print $file . \n;
}
/* returns:
./dummy.txt
./foo.txt
./ideas.txt
./robots.txt
./scite.txt
*/
/*
** other examples:
*/
// also possible:
$files = glob('*.*');
sort($files);
// This shows how to use the GLOB_BRACE flag:
$images = glob(images/{*.jpg,*.gif,*.png},GLOB_BRACE);
print_r($images);
/* Valid flags:
GLOB_MARK
GLOB_NOSORT
GLOB_NOCHECK
GLOB_NOESCAPE
GLOB_BRACE
GLOB_ONLYDIR
GLOB_ERR
see PHP.net manual for more info
*/
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。