当前位置:网站首页>php 获取文件夹下面的文件列表和文件夹列表
php 获取文件夹下面的文件列表和文件夹列表
2022-07-03 11:06:00 【BlizzardWu】
/** * 获取文件列表 * @param string $dir 绝对路径 */
function getDir($dir) {
$dirArray[] = NULL;
if (false != ($handle = opendir( $dir ))) {
$i=0;
while ( false !== ($file = readdir( $handle )) ) {
//去掉"“.”、“..”以及带“.xxx”后缀的文件
if ($file != "." && $file != ".."&&!strpos($file,".")) {
$dirArray[$i] = $file;
$i++;
}
}
//关闭句柄
closedir ($handle);
}
return $dirArray;
}
//获取文件列表
function getFile($dir) {
$fileArray[] = NULL;
if (false != ($handle = opendir ( $dir ))) {
$i=0;
while ( false !== ($file = readdir ( $handle )) ) {
if ($file != "." && $file != ".."&&strpos($file,".")) {
$fileArray[$i]['url'] = $dir.$file;
$fileArray[$i]['name'] = $file;
if($i==100){
break;
}
$i++;
}
}
//关闭句柄
closedir ($handle);
}
return $fileArray;
}
边栏推荐
- DS90UB949
- The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
- Sheet1$.输出[Excel 源输出].列[XXX] 出错。返回的列状态是:“文本被截断,或者一个或多个字符在目标代码页中没有匹配项。”。
- R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
- STL教程9-容器元素深拷贝和浅拷贝问题
- vulnhub之tomato(西红柿)
- Keepalived中Master和Backup角色选举策略
- 同事写了一个责任链模式,bug无数...
- ArcGIS应用(二十一)Arcmap删除图层指定要素的方法
- R语言使用aggregate函数计算dataframe数据分组聚合的均值(sum)、不设置na.rm计算的结果、如果分组中包含缺失值NA则计算结果也为NA
猜你喜欢

vulnhub之presidential

vulnhub之narak

Groovy test class and JUnit test

Machine learning 3.2 decision tree model learning notes (to be supplemented)

(database authorization - redis) summary of unauthorized access vulnerabilities in redis

同事写了一个责任链模式,bug无数...

Excel表格转到Word中,表格不超边缘纸张范围

Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation

Analysis of EPS electric steering system

PHP Basics
随机推荐
rxjs Observable filter Operator 的实现原理介绍
Keepalived中Master和Backup角色选举策略
Slam mapping and autonomous navigation simulation based on turnlebot3
2022 东北四省赛 VP记录/补题
Go语言实现静态服务器
Viewing binary bin files with notepad++ editor
STL教程8-map
Yintai department store ignites the city's "night economy"
安装electron失败的解决办法
Concurrent programming - singleton
银泰百货点燃城市“夜经济”
Kibana~Kibana的安装和配置
同事写了一个责任链模式,bug无数...
Xml的(DTD,xml解析,xml建模)
ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
R language uses data The table package performs data aggregation statistics, calculates window statistics, calculates the median of sliding groups, and merges the generated statistical data into the o
Web安全总结
phpcms 提示信息頁面跳轉showmessage
. \vmware-vdiskmanager. exe -k “c:\\xxxxx.vmdk”
Spl06-007 air pressure sensor (example of barometer)