嗨 我想構建簡單的目錄瀏覽器瀏覽文件夾和子文件夾uing php RecursiveDirectoryIterator ..我需要幫助如何創建此。我已經開始使用下面的代碼。建立一個簡單的目錄瀏覽器使用php RecursiveDirectoryIterator
$dir = dirname(__FILE__); //path of the directory to read
$iterator = new RecursiveDirectoryIterator($dir);
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {
if (!$file->isFile()) { //create hyperlink if this is a folder
echo "<a href=". $file->getPath().">" . $file->getFilename() . "\</a>";
}else{ //do not link if this is a file
$file->getFilename()
}
}
什麼是你確切的問題? – cweiske 2011-06-03 05:37:26