Skip to content

Instantly share code, notes, and snippets.

@norv
Created November 9, 2012 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norv/4046468 to your computer and use it in GitHub Desktop.
Save norv/4046468 to your computer and use it in GitHub Desktop.
// If it hasn't been modified since the last time this attachement was retrieved, there's no need to display it again.
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))
{
list($modified_since) = explode(';', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
if (strtotime($modified_since) >= filemtime($filename))
{
ob_end_clean();
// Answer the question - no, it hasn't been modified ;).
header('HTTP/1.1 304 Not Modified');
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment