![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 25 Pomógł: 0 Dołączył: 24.05.2003 Skąd: Łódź Ostrzeżenie: (0%) ![]() ![]() |
Mam sredni problemik ...
Potrzebuje liste plików z okreslonego katalogu, uporządkowanych w kolejności od daty ostatniej modyfikacji ( filecdate() albo filemtime() ) funkcja get_directory_file($path) wedlug Petera Mouldinga ![]() Kod function get_directory_file($path)
{ $path_id = opendir($path); while($file_name = readdir($path_id)) { if($file_name != "." and $file_name != "..") { $file["type"] = filetype($path . "/" . $file_name); if($file["type"] == "dir") { $file_array = get_directory_file($path . "/" . $file_name); if(isset($found)) { $found = array_merge($found, $file_array); } else { $found = $file_array; } } else { $file["changed"] = filectime($path . "/" . $file_name); $file["accessed"] = fileatime($path . "/" . $file_name); $file["group"] = filegroup($path . "/" . $file_name); $file["inode"] = fileinode($path . "/" . $file_name); $file["modified"] = filemtime($path . "/" . $file_name); $file["owner"] = fileowner($path . "/" . $file_name); $file["permissions"] = fileperms($path . "/" . $file_name); $file["size"] = filesize($path . "/" . $file_name); $found[$path][$file_name] = $file; } } } closedir($path_id); if(!isset($found)) { $found = array(); } return($found); } pozdrawiam i licze na to ze ktos mi :arrow: pomoze. ------------------------------- temat nie na PRO (DeyV) -------------------- ------
aven |
|
|
![]()
Post
#2
|
|
![]() Administrator planeta/IRC Grupa: Przyjaciele php.pl Postów: 385 Pomógł: 0 Dołączył: 19.04.2003 Skąd: Zabrze Ostrzeżenie: (0%) ![]() ![]() |
Wystarczy array_multisort, pobierasz tablice za pomocą swojej funkcji, następnie tworzysz nową zawierającą tylko element 'modified' każdego pliku z poprzedniej i potem wrzucasz obie w array_multisorta z odpowiednimi parametrami (w manualu jest wszystko opisane).
-------------------- "Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning."
Cudi's devBlog |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 18.07.2025 - 16:24 |