欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP遍歷某個目錄下的所有文件和子文件夾的實現(xiàn)代碼

 更新時間:2013年06月28日 14:54:10   作者:  
本篇文章是對PHP遍歷某個目錄下的所有文件和子文件夾的實現(xiàn)代碼進行了詳細的分析介紹,需要的朋友參考下
復(fù)制代碼 代碼如下:

<?php
 function read_all_dir ( $dir )
    {
        $result = array();
        $handle = opendir($dir);
        if ( $handle )
        {
            while ( ( $file = readdir ( $handle ) ) !== false )
            {
                if ( $file != '.' && $file != '..')
                {
                    $cur_path = $dir . DIRECTORY_SEPARATOR . $file;
                    if ( is_dir ( $cur_path ) )
                    {
                        $result['dir'][$cur_path] = read_all_dir ( $cur_path );
                    }
                    else
                    {
                        $result['file'][] = $cur_path;
                    }
                }
            }
            closedir($handle);
        }
        return $result;
    }
?>

相關(guān)文章

最新評論