2015-04-23 41 views

回答

1
<?php 

$finder = new Finder(); 
$finder->files() 
    ->in(__DIR__) 
    ->sort(function (\SplFileInfo $a, \SplFileInfo $b) { 
     return filesize($a->getRealpath()) < filesize($b->getRealpath()); 
    }); 

foreach ($finder as $file) { 
    echo filesize($file->getRealpath()) . PHP_EOL; 
} 

就是这样!

相关问题