Getting last modified info from files with PHP when filemtime, stat['mtime'], and get_headers fail -
I am trying to display the images in reverse order when they were last modified. Unfortunately, get_headers () only works for URLs, and both states ['meet'] and filemate () fail for me Do I have any other methods to get the last modified information for a file? At the moment my code is:
if (isset ($ _ GET ['start']) and "true" === $ _GET ['start']) {$ images = array (); If ($ dir = dir ('images')) {$ count = 0; While (wrong! == ($ file = $ dir-> read ()) {if_dir ($ file) & amp; $ File! == '.' & Amp; Amp; $ File! == '..' & amp; (Substr ($ file, -3) === 'jpg' || substrate ($ file, -3) === 'png' || substr ($ file, -3) === 'GIF')) { $ LastModified = filemtime ($ file); $ Image [$ lastModified] = $ file; ++ $ count; }} Echo json_encode ($ Picture); } Else {echo "directory could not be opened"; }}
Before you call the file code, enter filemtime ($ file) )
. Try
$ lastMod = filemtime ("images / .file.");
Comments
Post a Comment