Skip to content

Instantly share code, notes, and snippets.

@sueharaluke
Created November 4, 2018 07:04
Show Gist options
  • Save sueharaluke/06518e8f538ff5933e3a2fb323df2db3 to your computer and use it in GitHub Desktop.
Save sueharaluke/06518e8f538ff5933e3a2fb323df2db3 to your computer and use it in GitHub Desktop.
Add timestamp to css/js after update
<?php
$cssfile = '/styles.css'
?>
<link rel="stylesheet" href="<?php echo $cssfile.'?v='.filemtime($_SERVER['DOCUMENT_ROOT'].$cssfile);?>" />
<!--
If you prefer a full date
-->
<link rel="stylesheet" href="<?php echo $cssfile.'?v='.date'Ymd', filemtime($_SERVER['DOCUMENT_ROOT'].$cssfile));?>" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment