当前位置:网站首页>能够遍历一个文件夹下的所有文件和子文件夹
能够遍历一个文件夹下的所有文件和子文件夹
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;
}
}
}
边栏推荐
- 分支与循环(1)
- C countdown tool
- OpenAtom OpenHarmony分论坛,今天14:00见!附大事记精彩发布
- [autosar-rte] - introduction of 2-component, component and VFB
- The maximum recommended number of rows for MySQL is 2000W. Is it reliable?
- Real time editor of MATLAB
- [log] what does a log do? What is a log factory? Configuration and use of log4j? log4j. Properties file configuration, log4j jar package coordinates
- go语言切片Slice和数组Array对比panic runtime error index out of range问题解决
- 2.9.5 Ext JS的Object类型处理及便捷方法
- ECCV 2022 | 无需微调即可推广!基于配准的少样本异常检测框架
猜你喜欢
随机推荐
The maximum recommended number of rows for MySQL is 2000W. Is it reliable?
数据库高级学习笔记--系统包
如何使用JWT进行身份验证与授权
备受关注的Bit.Store,最新动态一览
居家健康诊断时代下,Senzo打造增强侧向流测试产品
数据库高级学习笔记--存储结构
ARouter源码解析(二)
478-82(56、128、718、129)
Method parameter transfer mechanism of C #
2022 supplementary questions for the first session of Niuke multi school
数据库高级学习笔记--存储函数
路由器固件解密思路
go语言切片Slice和数组Array对比panic runtime error index out of range问题解决
Feign call exception [running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = n]
译文推荐 | 调试 BookKeeper 协议 - 无界 Ledger
With frequent data leakage and deletion events, how should enterprises build a security defense line?
多线程一定能优化程序性能吗?
MATLAB的实时编辑器
脉冲风采|Committer 专访——腾讯工程师张大伟喊你吃“螃蟹”啦
Window源码解析(一):与DecorView的那些事








