Home > Backend Development > PHP Tutorial > A poorly written directory file listing program that supports multiple systems, can be sorted by time, and can enter multi-level directories. Please add other functions yourself_PHP Tutorial

A poorly written directory file listing program that supports multiple systems, can be sorted by time, and can enter multi-level directories. Please add other functions yourself_PHP Tutorial

WBOY
Release: 2016-07-13 17:24:48
Original
924 people have browsed it

Please criticize and correct me more! ! ! //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 "A poorly written directory file listing program that supports multiple systems, can be sorted by time, and can enter multi-level directories. Please add other functions yourself_PHP Tutorial $val"; echo " Creation time: ".@date( "Y-m-j:H:i:s",$key).""; } } unset($p); unset($cd); if($cf>0){ while(list($key,$val)= each($f)){ echo "


"; echo "A poorly written directory file listing program that supports multiple systems, can be sorted by time, and can enter multi-level directories. Please add other functions yourself_PHP Tutorial $val"; echo " Creation time: ".@date("Y-m-j:H:i:s",$key). ""; } } unset($f); unset($cf); closedir($handle); ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532107.htmlTechArticlePlease criticize and correct me! ! ! 0){ while(list($key,$val)=each($p)){ echo ; echo $val; echo creation time: .@date(Y-m-j:H:i:s,$key).; } } unset($p); unset($cd); if($cf>0){ while(...
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