当前位置:网站首页>PHP get the file list and folder list under the folder
PHP get the file list and folder list under the folder
2022-07-03 11:59:00 【BlizzardWu】
/** * Get file list * @param string $dir Absolute path */
function getDir($dir) {
$dirArray[] = NULL;
if (false != ($handle = opendir( $dir ))) {
$i=0;
while ( false !== ($file = readdir( $handle )) ) {
// Get rid of "“.”、“..” And the belt “.xxx” Postfix file
if ($file != "." && $file != ".."&&!strpos($file,".")) {
$dirArray[$i] = $file;
$i++;
}
}
// Closing handle
closedir ($handle);
}
return $dirArray;
}
// Get file list
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++;
}
}
// Closing handle
closedir ($handle);
}
return $fileArray;
}
边栏推荐
- (数据库提权——Redis)Redis未授权访问漏洞总结
- R语言使用原生包(基础导入包、graphics)中的hist函数可视化直方图(histogram plot)
- Vulnhub's Tomato (tomato)
- Download address and installation tutorial of vs2015
- Qt OpenGL 旋转、平移、缩放
- 《剑指offer 03》数组中重复的数字
- DEJA_VU3D - Cesium功能集 之 054-模拟火箭发射全过程
- (database authorization - redis) summary of unauthorized access vulnerabilities in redis
- Keepalived中Master和Backup角色选举策略
- Sheet1$.输出[Excel 源输出].列[XXX] 出错。返回的列状态是:“文本被截断,或者一个或多个字符在目标代码页中没有匹配项。”。
猜你喜欢

Download address and installation tutorial of vs2015

Solution to the second weekly test of ACM intensive training of Hunan Institute of technology in 2022

CGroup introduction

Vulnhub's Nagini

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

(数据库提权——Redis)Redis未授权访问漏洞总结

Vulnhub's cereal

Is BigDecimal safe to calculate the amount? Look at these five pits~~

Ripper of vulnhub

vulnhub之Ripper
随机推荐
Master and backup role election strategy in kept
OpenGL 绘制彩色的三角形
《剑指offer 03》数组中重复的数字
PHP导出word方法(一mht)
MySQL searches and sorts out common methods according to time
Quantitative calculation research
Visual Studio 2022下载及配置OpenCV4.5.5
The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
previous permutation lintcode51
836. Merge sets (day 63) and search sets
R language uses the aggregate function to calculate the mean value (sum) of dataframe data grouping aggregation without setting na The result of RM calculation. If the group contains the missing value
During FTP login, the error "530 login incorrect.login failed" is reported
剑指offer专项32-96题做题笔记
vulnhub之tomato(西红柿)
【mysql官方文档】死锁
R语言使用gridExtra包的grid.arrange函数将ggplot2包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
为什么我的mysql容器启动不了呢
vulnhub之GeminiInc
Qt OpenGL 纹理贴图
PHP导出word方法(一phpword)