请教如何查询系统最近5天生成的txt文件并提供链接给访问者上载

WBOY
Release: 2016-06-13 13:10:50
Original
776 people have browsed it

请问怎么查询系统最近5天生成的txt文件并提供链接给访问者下载
系统生成的txt文件都保存在download文件夹下面,请问怎么找出最近5天生成的txt文件,并提供链接给访问者下载
文件的命名是:label+日期时间
Label20120929133440.txt




------解决方案--------------------
$t = date('Ymd', strtotime('-5 day'));
$res = array();
foreach(glob('download/label*.txt') as $fn) {
if(substr($fn, 5, 6) > $t) $res[] = $fn;
}
$res 就是

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!