100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 遍历指定目录下的所有目录和文件的php代码【PHP】

遍历指定目录下的所有目录和文件的php代码【PHP】

时间:2023-02-13 13:19:55

相关推荐

遍历指定目录下的所有目录和文件的php代码【PHP】

后端开发|php教程

遍历目录,遍历文件

后端开发-php教程

群二维码导航源码,vscode 一键替换,ubuntu 移出内核,tomcat添加服务失败,爬虫基础书,php正则表达式 多行,武汉seo推广公司如何选择,网站后台网址忘了,免费或后台模板lzw

<?php

function listFiles($path){

$result = array();

foreach(glob($path.\\\."*") as $item){

$result[strtolower($item)] = $item;

if(is_dir($item)){

$result += listFiles($item);

}

}

return $result;

}

$path = E:\\web\\dianle;

foreach(listFiles($path) as $item){

echo $item.

;

}

2: scandir 读取指定目录到数组

asp管理信息系统源码,ubuntu查询gpu信息,爬虫高手在监狱,php编辑器软件中文免费版,vue seo问题lzw

function listFiles($path){

$result = array();

foreach( scandir($path) as $item ){

if($item != . && $item != .. ){

$item = $path.\\\.$item;

$result[strtolower($item)] = $item;

if(is_dir($item)){

$result += listFiles($item);

}

}

}

return $result;

}

$path = E:\\web\\dianle;

foreach(listFiles($path) as $item){

echo $item.

;

}

题库类app源码下载,ubuntu中如何删除,tomcat解压版官网下载,用爬虫人肉,php网站开发外包价位,seo课堂优化lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。