使用PHP通过创建或修改来排列文件 [英] Arrange files by creation or modification with PHP

查看:48
本文介绍了使用PHP通过创建或修改来排列文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在创建或修改日期之前获取文件夹中的文件名?

Is it possible to get the file names in a folder by the date of creation or modification?

谢谢.

推荐答案

<?php
    $files = array();
    $it = new DirectoryIterator(".");
    $it->rewind();
    while ($it->valid()) { 
        $files[$it->getFilename()] = $it->getMTime(); 
        $it->next();
    }

    asort($files);
    $files = array_keys($files);

这篇关于使用PHP通过创建或修改来排列文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆