Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sorgt für die korrekte Versionierung der CSS-Dateien
<?php
/**
* Automatische Versionierung der Dateinamen
* @param [[Type]] $file [[Description]]
* @return [[Type]] [[Description]]
*/
function auto_version($file)
{
if(strpos($file, '/') !== 0 || !file_exists($_SERVER['DOCUMENT_ROOT'] . $file))
return $file;
$mtime = filemtime($_SERVER['DOCUMENT_ROOT'] . $file);
return preg_replace('{\\.([^./]+)$}', ".$mtime.\$1", $file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.