当前位置:网站首页>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;
}
边栏推荐
- R language uses data The table package performs data aggregation statistics, calculates window statistics, calculates the median of sliding groups, and merges the generated statistical data into the o
- pragma-pack语法与使用
- (数据库提权——Redis)Redis未授权访问漏洞总结
- R语言使用data.table包进行数据聚合统计计算滑动窗口统计值(Window Statistics)、计算滑动分组中位数(median)并合并生成的统计数据到原数据集中
- Raven2 of vulnhub
- Concurrent programming - singleton
- vulnhub之presidential
- 并发编程-单例
- 网络通讯之Socket-Tcp(一)
- shardingSphere分库分表<3>
猜你喜欢

Php Export word method (One MHT)

The excel table is transferred to word, and the table does not exceed the edge paper range

vulnhub之narak

Ripper of vulnhub

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

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

vulnhub之Ripper

小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求

Niuniu's team competition

AOSP ~ NTP (Network Time Protocol)
随机推荐
Introduction to the implementation principle of rxjs observable filter operator
OpenStack中的测试分类
Hongmeng third training (project training)
Deploying WordPress instance tutorial under coreos
OpenGL 着色器使用
Based on MCU, how to realize OTA differential upgrade with zero code and no development?
vulnhub之presidential
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
libvirt 中体验容器
Xml的(DTD,xml解析,xml建模)
Qt+vtk+occt reading iges/step model
Qt OpenGL相机的使用
Solution à la défaillance de l'installation d'Electron
Qt OpenGL 旋转、平移、缩放
Cacti监控Redis实现过程
2022年中南大学夏令营面试经验
Wrong arrangement (lottery, email)
(数据库提权——Redis)Redis未授权访问漏洞总结
Dynamically monitor disk i/o with ZABBIX
Excel quick cross table copy and paste