Skip to content

Instantly share code, notes, and snippets.

@dubbs
Last active May 17, 2024 04:29
Show Gist options
  • Save dubbs/4459964 to your computer and use it in GitHub Desktop.
Save dubbs/4459964 to your computer and use it in GitHub Desktop.
versioning filenames with last modified time - PHP
<?php
function autoVer($url) {
$path = pathinfo($url);
$ver = '.' . filemtime($_SERVER['DOCUMENT_ROOT'] . $url) . '.';
echo $path['dirname'] . '/' . str_replace('.', $ver, $path['basename']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment