当前位置:网站首页>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;
}
边栏推荐
- DNS多点部署IP Anycast+BGP实战分析
- MySQL uses the method of updating linked tables with update
- Phpcms prompt message page Jump to showmessage
- Qt OpenGL 纹理贴图
- Viewing binary bin files with notepad++ editor
- ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
- phpcms 提示信息頁面跳轉showmessage
- vulnhub之cereal
- vulnhub之momentum
- The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
猜你喜欢

XML (DTD, XML parsing, XML modeling)

《剑指offer 03》数组中重复的数字

机器学习 3.2 决策树模型 学习笔记(待补)

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

STL tutorial 10 container commonalities and usage scenarios

"Jianzhi offer 04" two-dimensional array search

STL教程10-容器共性和使用场景

Unity3D学习笔记5——创建子Mesh

vulnhub之raven2

Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
随机推荐
金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
Test classification in openstack
Repo ~ common commands
STL教程9-容器元素深拷贝和浅拷贝问题
小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求
Nestjs configuration service, configuring cookies and sessions
libvirt 中体验容器
DS90UB949
C language utf8toutf16 (UTF-8 characters are converted to hexadecimal encoding)
vulnhub之narak
Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
The R language uses the hist function in the native package (basic import package, graphics) to visualize the histogram plot
ArcGIS应用(二十一)Arcmap删除图层指定要素的方法
R语言使用gridExtra包的grid.arrange函数将lattice包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
Web安全总结
Vulnhub geminiinc V2
Machine learning 3.2 decision tree model learning notes (to be supplemented)
Some common terms
Ripper of vulnhub
vulnhub之Ripper