我正在尝试使用RecursiveIteratorIterator
and RecursiveDirectoryIterator
。
我想在我的c:\
文件夹中获取所有文件。但我不知道为什么我不能得到结果,而是一个空白页。
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('c:/' ));
foreach( $it as $file ) {
$all[] = $file->getRealPath();
}
print_r($all);
但如果我使用这个代码,它的工作
foreach( $it as $key=>$file )
{
echo $key."=>".$file."\n";
}