Posted By

stiva71 on 08/04/14


Tagged

date modification


Versions (?)

file mod date


 / Published in: PHP
 

script to display file mod date

  1. function modDate() {
  2. $file = $_SERVER["SCRIPT_NAME"]; //gives /dir/abcd.php
  3. $break = Explode('/', $file); //array
  4. $pfile = $break[count($break) - 1]; //gives filename abcd.php
  5. echo "<p>
  6. This page was last modified on " . date("d F Y \a&#116; g:ia", filemtime($pfile)) . "
  7. </p>";
  8. }
  9.  
  10. ##updated
  11. function modDate() {
  12. $file = basename($_SERVER["SCRIPT_NAME"]); //gives abcd.php
  13. echo '<p>
  14. This page '.$file.' was last modified on ' . date("d F Y \a&#116; g:ia", filemtime($file)) . '
  15. </p>';
  16. }

Report this snippet  

You need to login to post a comment.