note 81194 added to function.filemtime

From: Date: Mon, 18 Feb 2008 05:01:48 +0000
Subject: note 81194 added to function.filemtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-136235@lists.php.net to get a copy of this message
This is a very handy function for dealing with browser caching. For example, say you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a pain in the ass. Instead, you can do this: <? echo ' <link rel="stylesheet" type="text/css" href="style.css?' . filemtime('style.css') . '" />'; ?> Sample output: <link rel="stylesheet" type="text/css" href="style.css?1203291283" /> By appending a GET value (the UNIX timestamp) to the stylesheet URL, you make the browser think the stylesheet is dynamic, so it'll reload the stylesheet every time the modification date changes. ---- Server IP: 66.207.199.35 Probable Submitter: 75.152.237.160 ---- Manual Page -- http://www.php.net/manual/en/function.filemtime.php Edit -- https://master.php.net/note/edit/81194 Del: integrated -- https://master.php.net/note/delete/81194/integrated Del: useless -- https://master.php.net/note/delete/81194/useless Del: bad code -- https://master.php.net/note/delete/81194/bad+code Del: spam -- https://master.php.net/note/delete/81194/spam Del: non-english -- https://master.php.net/note/delete/81194/non-english Del: in docs -- https://master.php.net/note/delete/81194/in+docs Del: other reasons-- https://master.php.net/note/delete/81194 Reject -- https://master.php.net/note/reject/81194 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136235) next »