当前位置:Gxlcms > PHP教程 > php澶氭枃浠朵笂浼犱唬鐮佷笁_PHP鏁欑▼|甯涔嬪

php澶氭枃浠朵笂浼犱唬鐮佷笁_PHP鏁欑▼|甯涔嬪

时间:2021-07-01 10:21:17 帮助过:5人阅读





鏄剧ず鏂囦欢澶瑰唴鏂囦欢


$sort_file=array();
$filefj=array();
define('FILEPATH','../filehandle/uploadfile/');
$sortlist=trim($_GET["sort"]);
$dir=opendir(FILEPATH);
echo'鏂囦欢涓婁紶浣嶇疆锛?.FILEPATH.'
';
echo'鏂囦欢鍒楄〃锛?.'

    ';

    if($sortlist == 'filetype'){
    while (($file=readdir($dir))!== false) {
    if ($file != "." && $file != "..") {
    $file=basename($file);
    $sort_file[]=$file;
    }
    }

    foreach ($sort_file as $key=>$var) {
    $filefj[]=explode('.',$var);
    }

    usort($filefj,'compare');

    foreach ($filefj as $key=>$val){
    $combinationfile=implode('.',$val);
    echo '
  • '. $combinationfile.'
  • ';
    }
    }else{
    while (($file=readdir($dir))!== false) {
    if ($file != "." && $file != "..") {
    $file=basename($file);
    echo '
  • '.$file.$file_size.'
  • ';
    }
    }
    }
    echo '
';
closedir($dir);
echo'
';
echo'鎸夋枃浠剁被鍨嬫帓搴?lt;/a> 鎸夋甯告枃浠舵帓搴?lt;/a> 缁х画涓婁紶鏂囦欢';

function compare($x,$y){
if($x[1]==$y[1])
return 0;
else if ($x[1]<$y[1])
return -1;
else return 1;
}
?>



鏂囦欢鏁堟灉灏变笉璇翠簡,鑷繁璇曚竴涓€灏辩煡閬撲簡.

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632022.htmlTechArticle!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head meta http-equiv=Con...

人气教程排行