/ Published in: PHP
With this snippet you will have the ability to deliver the most recent version of any file.
When dealing with a browser's cache you can't be certain your viewers are getting the most recent copy. By appending a GET value (the UNIX timestamp) to, for example, a stylesheet, you can make the browser think the stylesheet is dynamic, thus reloading the stylesheet time the modification date changes.
When dealing with a browser's cache you can't be certain your viewers are getting the most recent copy. By appending a GET value (the UNIX timestamp) to, for example, a stylesheet, you can make the browser think the stylesheet is dynamic, thus reloading the stylesheet time the modification date changes.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * lastModified * * @author demon.devin * @link PortableAppz.cu.cc/ * @copyright 2016 * @package lastMofified * @version 1.0 * * With this snippet you will have the ability to deliver the most recent version of any file. * When dealing with a browser's cache you can't be certain your viewers are getting the most * recent copy. By appending a GET value (the UNIX timestamp) to, for example, a stylesheet, * you can make the browser think the stylesheet is dynamic, thus reloading the stylesheet time * the modification date changes. * * PARAMETERS * $filepath string path to the file of the document you wish to use * * EXAMPLE: * <link rel="stylesheet" type="text/css" href="<?php echo lastModified('../css/style.css'); ?>" /> * * OUTPUT: * <link rel="stylesheet" type="text/css" href="style.css?1477050530" /> */ // //default settings function lastModified($filepath) { $timeStamp = $filepath.'?'.$lastModified; return $timeStamp; } } ?>
URL: http://portableappz.x10.mx/extras/lastModified