写的一个比较烂的目录文件列表程序,支持多系统,可按时间排序,可进入多层目录,其他功能就请自己加了! - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 写的一个比较烂的目录文件列表程序,支持多系统,可按时间排序,可进入多层目录,其他功能就请自己加了! (http://www.webasp.net/article/6/5935.htm) |
| -- 作者:未知 -- 发布日期: 2003-07-26 |
| 请大家多批评指正!!! <?//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 "排序规则:按时间 <a href=list.php?order=up&dir=$dir>升</a>(最老的文件在最前面) <a href=list.php?order=down&dir=$dir>降</a>(最新的文件在最前面)"; $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 "<br>"; echo "<IMG SRC=\"folder.gif\" WIDTH=\"15\" HEIGHT=\"13\" BORDER=0 > <a href=list.php?order=$order&dir=".urlencode($Path."/".$val).">$val</a>"; echo " 创建时间:".@date("Y-m-j:H:i:s",$key).""; } } unset($p); unset($cd); if($cf>0){ while(list($key,$val)=each($f)){ echo "<br>"; echo "<IMG SRC=\"file_unknow.gif\" WIDTH=\"13\" HEIGHT=\"15\" BORDER=0 > $val"; echo " 创建时间:".@date("Y-m-j:H:i:s",$key).""; } } unset($f); unset($cf); closedir($handle); ?> |
| webasp.net |