Home > Backend Development > PHP Tutorial > 再点一次Active的名,我把你的函数功能扩充了一下,嘻嘻,现在能_PHP

再点一次Active的名,我把你的函数功能扩充了一下,嘻嘻,现在能_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 12:28:45
Original
851 people have browsed it

把你的函数改写成递归函数,现在这个函数可以列出某指定目录内的所有文件及子目录内的文件啦。


function listdir($path)
{
   chdir($path);
   $d = dir($path);
   $d->path."
\n";
   print "

    ";
       while($entry=$d->read()){
            if ($entry"." and $entry".." ){
                $last=filemtime($entry);
                print "
  • ";
                $name=is_dir($entry)?("再点一次Active的名,我把你的函数功能扩充了一下,嘻嘻,现在能_PHP".$entry):("再点一次Active的名,我把你的函数功能扩充了一下,嘻嘻,现在能_PHP".$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);

?>


Related labels:
Statement of this Website
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
Latest Issues
ubuntu mongodb 出现 exception: connect failed
From 1970-01-01 08:00:00
0
0
0
An error occurred
From 1970-01-01 08:00:00
0
0
0
Why does clicking login jump to hello world?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template