Veröffentlicht 4. März 200619 j Mahlzeit, ich habe ein Skript geschrieben, welches dazu dient, in einer Galerie anzuzeigen, wann das letzte mal Bilder hinzugekommen sind. <? $handle=opendir('.'); $data = array(); while ($file = readdir ($handle)) { if ($file != "." && $file != "..") { $filedate = filemtime($file); } } closedir($handle); natsort($data); $data = array_reverse($data); $date = date("d.m.Y", $filedate); echo "<font size='1' face='Verdana'> Letztes Bild vom $date</font>"; ?> [/PHP] Es läuft auch ganz wunderbar, ohne Probleme. Lege ich die Datei nun jedoch nicht im Bilderordner ab, sondern bspw. im Root-Ordner der Galerie, und ändere ich den entsprechenden Opendir Pfad, so bekomm ich stets nur noch den 1.1.1970 angezeigt. Kann mir jemand sagen wo sich der Fehler verbirgt? Ich sehe ihn nicht
4. März 200619 j anscheinend passt dein Opendir nicht... Ausserdem würde ich das anders lösen, da das auslesen von großen Ordnern sehr lange dauern kann...
5. März 200619 j Offenbar kümmern dich Subdirectories nicht. Dann reicht es die filemtime auszugeben. To get the last modification time of a directory, you can use this: $getLastModDir = filemtime("/path/to/directory/."); Take note on the last dot which is needed to see the directory as a file and to actually get a last modification date of it. Aber: "When using this function to get the modified date of a directory, it returns the date of the file in that directory that was last modified." this is not (necessarily) correct, the modification time of a directory will be the time of the last file *creation* in a directory (and not in it's sub directories).
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.