2015-04-23 60 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; 
} 

就是這樣!

相關問題