RecursiveDirectoryIterator throws UnexpectedValueException on quot;Too many open filesquot;(RecursiveDirectoryIterator 在“打开的文件太多上抛出 UnexpectedValueException)
问题描述
以下代码:
如果您尝试迭代的子文件夹中有太多文件,则会引发以下异常:
Throws the following exception if there are too many files in a sub-folder which you're trying to iterate over:
如何在不遇到此异常的情况下成功迭代大量文件夹和文件?
How can you successfully iterate over a large amount of folders and files without experiencing this exception?
推荐答案
只需将迭代器转换为数组,iterator_to_array
函数,看来您可以迭代任意数量的文件:
Simply by converting the iterator to an array with the iterator_to_array
function, it seems like you can iterate over as many files as you'd like:
这篇关于RecursiveDirectoryIterator 在“打开的文件太多"上抛出 UnexpectedValueException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!