我有一个 php foreach 脚本,它将遍历目录中的所有文件并将它们列出,并带有一个文件夹图标和一个文件图标。
由于列表一直到它检查了所有文件和文件夹,它才离开页面底部。
只是好奇人们认为最简单的方法是什么,让下面的代码在到达页面底部后进入另一列?
foreach (glob("$dir/*") as $filename) {
//Set the full path and filename
$path_parts = pathinfo($filename);
//Set the filename to display
$itemname = $path_parts['basename'];
//Remove bullet points from the list
echo "<ul style='list-style:none'>";
//If it is a directory, list it. Else do nothing
if(is_dir($filename)) {
//Link points back to lister, with new directory
echo "<li><a href='list.php?dir=".$filename."' style='font-size:18px;'>
<img src='/site/images/files/folder.png' height='32px' width='32px' border='0' /> ".$itemname."</a></li>";
}
echo "</ul>";
}
感谢人们可以提供的任何建议
编辑