孔祥熙简介,寒亭一中新校区,人体艺术网导航
<?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.'<br />';
}
2: scandir 读取指定目录到数组
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.'<br />';
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论