0
我有一个多画廊页面,显示按文件夹分隔的图像。问题是它是按字母顺序(文件夹名称)显示在我的页面中,我如何将其更改为日期文件夹被修改为排序并显示在我的页面中?PHP按文件夹排序修改日期
<div class="pageWrap">
<div class="row">
<div class="col-md-2 col-md-push">
<div class="panel panel-info">
<div class="panel-heading"><center>Gallery</center></div>
</div>
</div>
</div>
<?php $files = scandir('galleries'); ?>
<?php foreach ($files as $file): ?>
<?php $dir = 'galleries/' . $file; ?>
<?php if (is_dir($dir) && $file != '.' && $file != '..'): ?>
<h2><?php echo ucwords($file); ?></h2>
<?php $gallery = UGallery::init()->createGallery($dir, $file); ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
你为什么关闭PHP的标签在每一行之后? – Andreas
可能重复[scandir()按日期修改排序](https://stackoverflow.com/questions/11923235/scandir-to-sort-by-date-modified) – Andreas