<?php
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator('./'),
RecursiveIteratorIterator::SELF_FIRST);
foreach($iterator as $file) {
if($file->isDir()) {
echo "\n" . strtoupper($file->getRealpath()), PHP_EOL;
}
}
?>
以上就是我到目前为止所做的。我希望通过dirs和sub-dirs看看哪些是可写的。
答案 0 :(得分:0)
您是否尝试过使用isWritable()方法?
<?php
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator('./'),
RecursiveIteratorIterator::SELF_FIRST);
foreach($iterator as $file) {
if($file->isDir()) {
echo "\n" . strtoupper($file->getRealpath()), PHP_EOL;
if($file->isWritable()) {
echo "directory is writable\n";
}
}
}
?>