在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
有关array_multisort的使用
$dir_name="../upload/Study";
$dir = opendir($dir_name); $basename = basename($dir_name); $fileArr = array(); while ($file_name = readdir($dir)) { //Get file modification date $fName = "$dir_name/$file_name"; $file_isdir = is_dir($fName); $fTime = filemtime($fName); $fileArr[]=array("name"=>$file_name,"isdir"=>$file_isdir,"time"=>date("Y-M-d H:i:s",$fTime)); } foreach ($fileArr as $key => $row) { $isdir[$key] = $row['isdir']; $time[$key] = $row['time']; $name[$key]=$row['name']; } array_multisort($isdir,SORT_DESC,$time,SORT_DESC,$fileArr); echo "<pre>"; print_r($fileArr); echo "</pre>";die(); closedir ($dir); ?> |
2022-08-17
2022-11-06
2022-08-17
2022-08-14
2022-07-18
请发表评论