作者: 溪水清澈
<?php
//循环方式, 处理文件夹下的所有文件
function processAllFiles( $basePath )
{
$dirs = array( realpath( $basePath ) );
while( $dir = each( $dirs ) )
{
$path = $dir[ 'value' ] . DIRECTORY_SEPARATOR;
$files = scandir( $path );
foreach( $files as $file )
{
$fullPath = $path . $file;
if( is_dir( $fullPath ) && $file != '.' && $file != '..' )
{
$dirs[] = $fullPath;
} elseif( is_file( $fullPath ) )
{
//对文件进行处理
echo $fullPath, "\n";
}
}
}
}