[代码] [PHP]代码
02 | class RecursiveFileFilterIterator extends FilterIterator { |
04 | protected $ext = array ( 'jpg' , 'gif' ); |
09 | public function __construct( $path ) { |
10 | parent::__construct( new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ))); |
16 | public function accept() { |
17 | $item = $this ->getInnerIterator(); |
18 | if ( $item ->isFile() && |
19 | in_array( pathinfo ( $item ->getFilename(), PATHINFO_EXTENSION), $this ->ext)) { |
26 | foreach ( new RecursiveFileFilterIterator( 'D:/history' ) as $item ) { |
转载于:https://www.cnblogs.com/xingmeng/archive/2013/02/01/2888882.html