Skip to content

Instantly share code, notes, and snippets.

@piffall
Created October 16, 2014 06:44
Show Gist options
  • Save piffall/fc924359818ec47cb6d5 to your computer and use it in GitHub Desktop.
Save piffall/fc924359818ec47cb6d5 to your computer and use it in GitHub Desktop.
Cache HTTP header PHP
<?php
$ttl = 5*60; // Minutes x seconds
header_remove("Pragma");
header("Cache-Control: private,max-age=$ttl");
header("Date: ".gmdate('D, d M Y H:i:s \G\M\T',time()));
header("Expires: ".gmdate('D, d M Y H:i:s \G\M\T',time()+$ttl));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment