当前位置:网站首页>能够遍历一个文件夹下的所有文件和子文件夹
能够遍历一个文件夹下的所有文件和子文件夹
2022-07-28 09:26:00 【MountainYanYL】
//使用递归来实现,关于什么是递归 ,自行查找
public static function my_scandir($dir){
$files = array();
if(is_dir($dir)){
if($handle =opendir($dir)){
while (($file = readdir($handle))!== false){
if($file != '.' && $file!='..'){
$_dir = $dir ."/".$file;
if(is_dir($_dir)){
$files[$file] = self::my_scandir($_dir);
}else{
$files[] = $_dir;
}
}
}
closedir($handle);
return $files;
}
}
}
边栏推荐
- OSS直连上传-Rails服务实践
- NET 3行代码实现文字转语音功能
- Opencv installation configuration test
- 实验五:用户与用户组管理
- Use xposed to crack the software
- C form application uses object binding DataGridView data binding
- Scalable search bar, imitating Huawei application market
- Introduction to shardingsphere (I)
- 就这么一个简单的校验,80%的程序员却做不到,更不理解!
- Pytorch deep learning practice lesson 9 multi classification problems (handwritten numeral MNIST)
猜你喜欢

学个锤子 | .Net零基础逆向教程 第三课(壳与作业)

【日志】日志干什么的?日志工厂是什么?log4j 的配置和使用? log4j.properties 文件配置、log4j jar包坐标

How promise instance solves hell callback

478-82(56、128、718、129)

JS提升:实现flat平铺的底层原理

Create SSL certificate using OpenSSL

IJCAI 2022 | the latest overview of graph structure learning: research progress and future prospects

Linux操作系统(Centos7)安装MySQL
Edge团队详解如何通过磁盘缓存压缩技术提升综合性能体验

Buckle 376 swing sequence greedy
随机推荐
Salted fish esp32 instance - mqtt lit LED
[log] what does a log do? What is a log factory? Configuration and use of log4j? log4j. Properties file configuration, log4j jar package coordinates
How view works
Changes in the relationship between data and application in IT industry
Pulse style | exclusive interview with Committee -- Tencent engineer Zhang Dawei calls you to eat "crab"
Create SSL certificate using OpenSSL
Source code analysis of activityrouter
分支与循环(1)
时序分析41 - 时序预测 TBATS模型
View的工作原理
2022 supplementary questions for the first session of Niuke multi school
With frequent data leakage and deletion events, how should enterprises build a security defense line?
Method parameter transfer mechanism of C #
pycharm使用conda调用远程服务器
[JVM] JVM refers to floating point number
ECCV 2022 | 无需微调即可推广!基于配准的少样本异常检测框架
2022-7-27周报
软件测试与质量学习笔记1---黑盒测试
SQL server, MySQL master-slave construction, EF core read-write separation code implementation
Introduction to shardingsphere (I)