sKunKbad Posted June 18, 2007 Share Posted June 18, 2007 For some reason, when you view the http header info for my .php pages, it does not show a last modified date and time. So, thinking that I could create one, I tried this: <?php header("Last-Modified: ".filectime($_SERVER['PHP_SELF']); ?> but it doesn't work. Does anyone know how to do what I am trying to do? Link to comment https://forums.phpfreaks.com/topic/56055-solved-header-last-modified-time/ Share on other sites More sharing options...
sKunKbad Posted June 18, 2007 Author Share Posted June 18, 2007 OK, this works: <?php header("Last-Modified: " . date ("D, j M Y ", getlastmod()) . (date ("H", getlastmod())+4) . date (":i:s", getlastmod()) . " GMT");?> but the problem is that if the lastmod was during certain hours, the output for the hour might show something like 24 or 26. Since there is no 24 or 26th hour in a day, I need to come up with something that keeps the date right, but I am stuck and need help. Please help! Link to comment https://forums.phpfreaks.com/topic/56055-solved-header-last-modified-time/#findComment-276986 Share on other sites More sharing options...
sKunKbad Posted June 18, 2007 Author Share Posted June 18, 2007 This is getting better, but I just want to know if there is an easier way: $hours = date ("H", getlastmod())+4; $daynumber = date ("j", getlastmod()); if ($hours == 24){ $hours = 00; $daynumber = $daynumber + 1; } if ($hours >= 25){ $hours = $hours -24; $daynumber = $daynumber + 1; } header("Last-Modified: " . date ("D, ", getlastmod()) . $daynumber . date(" M Y ", getlastmod()) . "$hours" . date (":i:s", getlastmod()) . " GMT"); Hasn't anyone ever done anything like this before? Link to comment https://forums.phpfreaks.com/topic/56055-solved-header-last-modified-time/#findComment-277004 Share on other sites More sharing options...
sKunKbad Posted June 18, 2007 Author Share Posted June 18, 2007 I was just being dumb... This is all it took to make it work: <?php header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) ." GMT"); ?> Link to comment https://forums.phpfreaks.com/topic/56055-solved-header-last-modified-time/#findComment-277166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.