php
如下的代码,如何改成按文件名排序。下面的页面 list.php是可以列出c:\filelist里的文件,可以需要用文件名来排序,另外,想多加一个动作叫Open,是在浏览器打开文件,不是下载。谢谢!| File Listing |
Sign Out |
|
$predir = realpath($dir . "/../"); if($predir > $basedir) $predir = str_replace($basedir . "/","",$predir); if($predir == $basedir) $predir = "."; if($dir > $basedir) echo "Up Level"; ?> |
| Folder | \n";
| $basedir ? str_replace($basedir . "/",'',$dir . "/") : '') . urlencode($file)."\">$file | \n";
| Filename | Date | Size | Action |
| $file | \n";$lastsave | \n";$size KB | \n";$basedir ? str_replace($basedir . "/",'',$dir . "/") : '').urlencode($file)."\">Download | \n";
不用目录函数,改用 glob 函数。结果就是排序的
当然你也可以附加 GLOB_NOSORT 参数阻止这一行为
请问该改哪里? 如何改呢? 谢谢!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号