当前位置:网站首页>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;
}
边栏推荐
- ArcGIS application (XXI) ArcMap method of deleting layer specified features
- 安装electron失败的解决办法
- (数据库提权——Redis)Redis未授权访问漏洞总结
- vulnhub之tomato(西红柿)
- Test classification in openstack
- 利用Zabbix动态监控磁盘I/O
- Unity3D学习笔记5——创建子Mesh
- 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
- Notes on 32-96 questions of sword finger offer
- 在CoreOS下部署WordPress实例教程
猜你喜欢
随机推荐
ftp登录时,报错“530 Login incorrect.Login failed”
vulnhub之Ripper
Master and backup role election strategy in kept
Go语言实现静态服务器
Qt OpenGL相机的使用
量化计算调研
Wrong arrangement (lottery, email)
Interview experience in summer camp of Central South University in 2022
R语言使用gridExtra包的grid.arrange函数将ggplot2包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
The R language uses the hist function in the native package (basic import package, graphics) to visualize the histogram plot
Quantitative calculation research
Why can't my MySQL container start
MCDF Experiment 1
为什么我的mysql容器启动不了呢
抓包整理外篇fiddler———— 会话栏与过滤器[二]
uniapp scroll view 解决高度自适应、弹框滚动穿透等问题。
STL教程8-map
在CoreOS下部署WordPress实例教程
vulnhub之tomato(西红柿)
Vulnhub geminiinc V2