当前位置:网站首页>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;
}
边栏推荐
- 网络通讯之Socket-Tcp(一)
- 抓包整理外篇fiddler———— 会话栏与过滤器[二]
- Ripper of vulnhub
- ArcGIS application (XXI) ArcMap method of deleting layer specified features
- Hongmeng third training (project training)
- vulnhub之Nagini
- The excel table is transferred to word, and the table does not exceed the edge paper range
- 网络通讯之Socket-Tcp(一)
- 836. 合并集合(DAY 63)并查集
- 剑指offer专项32-96题做题笔记
猜你喜欢
随机推荐
Visual Studio 2022下载及配置OpenCV4.5.5
DEJA_VU3D - Cesium功能集 之 053-地下模式效果
CGroup introduction
Pragma pack syntax and usage
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
Excel快速跨表复制粘贴
The tutor put forward 20 pieces of advice to help graduate students successfully complete their studies: first, don't plan to take a vacation
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
Momentum of vulnhub
The R language uses the hist function in the native package (basic import package, graphics) to visualize the histogram plot
Simple factory and factory method mode
Kubernetes three dozen probes and probe mode
Experience container in libvirt
Concurrent programming - singleton
PHP导出word方法(一phpword)
同事写了一个责任链模式,bug无数...
Interview experience in summer camp of Central South University in 2022
R语言使用原生包(基础导入包、graphics)中的hist函数可视化直方图(histogram plot)
STL教程8-map
R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g