Home >php教程 >php手册 >写的一个比较烂的目录文件列表程序,支持多系统,可按时间排序,可进入多层目录,其他功能就请自己加了

写的一个比较烂的目录文件列表程序,支持多系统,可按时间排序,可进入多层目录,其他功能就请自己加了

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:25:00938browse

请大家多批评指正!!! //List.php //Power by Devchina.com 2oa.net $Path=($dir)?urldecode($dir):"d:";//最好用session设置路径安全 $handle=opendir($Path); while ($file = readdir($handle)) { $newpath=$Path."/".$file; if($file==".." or $file==".") { //你可以把..或者.加上连接作为回上一层的"; continue; } if(is_dir($newpath)){ $p[intval(filemtime($newpath))]=$file; }else { $f[intval(filemtime($newpath))]=$file; } } echo "排序规则:按时间 升(最老的文件在最前面) 降(最新的文件在最前面)"; $cd=($order=="up")?sizeof(@ksort($p)):sizeof(@krsort($p)); $cf=($order=="up")?sizeof(@ksort($f)):sizeof(@krsort($f)); if($cd>0){ while(list($key,$val)=each($p)){ echo "
"; echo " $val"; echo " 创建时间:".@date("Y-m-j:H:i:s",$key).""; } } unset($p); unset($cd); if($cf>0){ while(list($key,$val)=each($f)){ echo "


"; echo " $val"; echo " 创建时间:".@date("Y-m-j:H:i:s",$key).""; } } unset($f); unset($cf); closedir($handle); ?>
Statement:
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
Previous article:PHP4对WindowsCOM的支持Next article:另类留言