Skip to content

Instantly share code, notes, and snippets.

@Sketches-su
Created January 26, 2015 07:04
Show Gist options
  • Save Sketches-su/5c4620a0e6a7717e6354 to your computer and use it in GitHub Desktop.
Save Sketches-su/5c4620a0e6a7717e6354 to your computer and use it in GitHub Desktop.
Выдаёт HTTP-заголовки, запрещающие кэширование
function noCaching()
{
if ((PHP_SAPI == 'cli') || headers_sent()) {
return;
}
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment