PHP lists file directory tree php php directory operation php mkdir multi-level directory

WBOY
Release: 2016-07-29 08:53:52
Original
1176 people have browsed it

PHP is a way to list the file directory tree. It can also determine whether the file is a directory and clearly display the files in the directory. It can help us understand the directory situation well and quickly see the directory. How many directories are there in total and which ones are not directory files? This is a relatively practical little method that can be applied to In the php file management system, it helps us list the file directory tree, understand it at a glance, and improve its files. It is a good PHP file for managing directories. The source code is as follows:

<?php  
$str= "D:/xxcms/";  
ListDir($str);  
   
functionListDir ($dirname)  
{  
    $Ld= dir($dirname);  
    echo"<ul>";  
    while(false !== ($entry= $Ld->read())) {  
        $checkdir=$dirname."/".$entry;  
        if(is_dir($checkdir)&&!preg_match("[^\.]",$entry)){  
           echo"<li><p>".$checkdir."当前<span style=&#39;color:#ff00a
a&#39;>是</span>目录</p></li>";  
           ListDir($checkdir);  
        }else{  
            echo"<li><p>".$entry."当前不是目录</p></li>";  
        }  
    }  
    $Ld->close();  
    echo"</ul>";  
}  
?>
Copy after login

The above introduces PHP to list the file directory tree, including PHP and directory content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!