Home > Backend Development > PHP Tutorial > PHP目录中列出所有文件和文件夹函数

PHP目录中列出所有文件和文件夹函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 13:02:18
Original
1371 people have browsed it

function list_files($dir)<br />{<br />    if(is_dir($dir))<br />    {<br />        if($handle = opendir($dir))<br />        {<br />            while(($file = readdir($handle)) !== false)<br />            {<br />                if($file != "." && $file != ".." && $file != "Thumbs.db"/*pesky windows, images..*/)<br />                {<br />                    echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br>'."\n";<br />                }<br />            }<br />            closedir($handle);<br />        }<br />    }<br />}
Copy after login


Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template