当前位置:网站首页>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;
}
边栏推荐
- 聊聊Flink框架中的状态管理机制
- Nestjs configuration service, configuring cookies and sessions
- Master and backup role election strategy in kept
- uniapp实现点击加载更多
- Kubernetes 三打探针及探针方式
- R语言使用aggregate函数计算dataframe数据分组聚合的均值(sum)、不设置na.rm计算的结果、如果分组中包含缺失值NA则计算结果也为NA
- Notes on 32-96 questions of sword finger offer
- How should intermediate software designers prepare for the soft test
- 鸿蒙第三次培训(项目实训)
- Slam mapping and autonomous navigation simulation based on turnlebot3
猜你喜欢

vulnhub之tomato(西红柿)

AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...

vulnhub之Ripper

Momentum of vulnhub

"Jianzhi offer 04" two-dimensional array search

金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~

OpenGL 索引缓存对象EBO和线宽模式

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

Understand go language context in one article

Unity3D学习笔记5——创建子Mesh
随机推荐
Excel quick cross table copy and paste
Experience container in libvirt
简单工厂和工厂方法模式
Sheet1$. Output [excel source output] Error in column [xxx]. The returned column status is: "the text is truncated, or one or more characters have no matches in the target code page.".
Mysql根据时间搜索常用方法整理
vulnhub之GeminiInc
P3250 [HNOI2016] 网络 + [NECPC2022] F.Tree Path 树剖+线段树维护堆
Raven2 of vulnhub
After watching the video, AI model learned to play my world: cutting trees, making boxes, making stone picks, everything is good
Kibana - installation and configuration of kibana
Go language to realize static server
Understand go language context in one article
Mmc5603nj geomagnetic sensor (Compass example)
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
VS2015的下载地址和安装教程
vulnhub之narak
牛牛的组队竞赛
Numpy np.max和np.maximum实现relu函数
Slam mapping and autonomous navigation simulation based on turnlebot3
导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....