Search the Community
Showing results for tags 'filemtime'.
-
Hello All, I'm trying to show the modication date of a file with php output. I added the "filemtime" to the print() function but I want it to show the date and time rather than just numbers. Any help would be greatly appreciated Here's my source: <style type="text/css"> * { font-family: tahoma; font-size: 16px; } </style> <?php // open this directory $myDirectory = opendir("."); // get each entry while($entryName = readdir($myDirectory)) { $pathinfo = pathinfo($entryName); if($pathinfo['extension'] != 'php, ink') $dirArray[] = $entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH><a style='float:left;' href='/joe'>Go Back Home</a></TH><TH></TH><TH></TH><TH></TH></TR>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th><th>Modified</th></TR>\n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("<td>"); print(filemtime($dirArray[$index])); print("</td>"); print("</TR>\n"); } } print("</TABLE>\n"); ?> Thank you all in advance
-
I just noticed something while updating one of the sites I manage. I use this code in the footer that is included in every page on the site: <p> <?php $current_file_name = ($_SERVER['REQUEST_URI']); $current_path = ($_SERVER['DOCUMENT_ROOT']); $full_name = $current_path.$current_file_name; $last_modified = filemtime($full_name); print("This page last changed: "); print(date("F j, Y - h:i A", $last_modified)); ?> </p> However, here's what I found a tad odd. If you go to: http://westminsteratcrabapple.com/index.php you get the correct modification date/time. But, if you go to: http://westminsteratcrabapple.com/ it shows a different date/time, which is of the folder, not imdex.php. Any thoughts appreciated.