Created
April 10, 2018 11:24
-
-
Save Xvezda/0e68f7209880819bcc3e0edf22df47be to your computer and use it in GitHub Desktop.
PHP static file query string ( by last modification time ) for browser cache revalidate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function load_script($file) { | |
echo '<script type="text/javascript" src="' . $file . "?t=" . filemtime($file) . '"> | |
</script>' . PHP_EOL; | |
} | |
?> | |
<!doctype html> | |
<html lang="ko"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Javascript</title> | |
</head> | |
<body> | |
<?php load_script('./script.js'); ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// happy coding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment