当前位置:网站首页>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;
}
边栏推荐
- STL tutorial 8-map
- OpenGL 绘制彩色的三角形
- Vulnhub geminiinc V2
- Mmc5603nj geomagnetic sensor (Compass example)
- How to get started embedded future development direction of embedded
- 利用Zabbix动态监控磁盘I/O
- uniapp实现点击加载更多
- Excel表格转到Word中,表格不超边缘纸张范围
- R语言使用gridExtra包的grid.arrange函数将lattice包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
- (数据库提权——Redis)Redis未授权访问漏洞总结
猜你喜欢

Ripper of vulnhub

Raven2 of vulnhub

《剑指offer 04》二维数组查找

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

DS90UB949

This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system

Based on MCU, how to realize OTA differential upgrade with zero code and no development?

cgroup简介

Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.

Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
随机推荐
Unity3D学习笔记5——创建子Mesh
Dynamic programming (interval DP)
Understand go language context in one article
AOSP ~ NTP ( 网络时间协议 )
vulnhub之cereal
Based on MCU, how to realize OTA differential upgrade with zero code and no development?
Momentum of vulnhub
Slam mapping and autonomous navigation simulation based on turnlebot3
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
Nestjs configuration service, configuring cookies and sessions
R language uses grid of gridextra package The array function combines multiple visual images of the ggplot2 package horizontally, and the ncol parameter defines the number of columns of the combined g
ArcGIS应用(二十一)Arcmap删除图层指定要素的方法
vulnhub之pyexp
金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
uniapp scroll view 解决高度自适应、弹框滚动穿透等问题。
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
. \vmware-vdiskmanager. exe -k “c:\\xxxxx.vmdk”
Some common terms
AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
mysql使用update联表更新的方法