Skip to content

Instantly share code, notes, and snippets.

@a1exlism a1exlism/php_ls-al
Created Jul 31, 2016

Embed
What would you like to do?
<?php
function listDir($dir)
{
if(is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if((is_dir($dir."/".$file)) && $file!="." && $file!="..")
{
echo "<b><font color='red'>文件名:</font></b>",$file,"<br><hr>";
listDir($dir."/".$file."/");
}
else
{
if($file!="." && $file!="..")
{
echo $file."<br>";
}
}
}
closedir($dh);
}
}
}
listDir("./");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.