Rewrite your function into a recursive function. Now this function can list all files in a specified directory and files in subdirectories.
function listdir($path)
{
chdir($path);
$d = dir($path);
$d->path. "
";
print "
";
while($entry=$d->read()){
if ($entry< >"." and $entry<>".." ){
$last=filemtime($entry);
print "- ";
$name=is_dir($entry )?("".$entry):("".$entry);
print $name." --- ".date ("Y/m/d h:i:s",$last);
if (is_dir($path."/".$entry)){
listdir($path."/".$entry );
}
}
}
$d->close();
print "
";
}
$listpath="c :";
echo $listpath;
listdir($listpath);
?>
http://www.bkjia.com/PHPjc/631452.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631452.htmlTechArticleRewrite your function into a recursive function. Now this function can list all files and subtitles in a specified directory The files in the directory. ? function listdir($path) { chdir($path); $d = d...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn