A função header() da PHP
Dica publicada em PHP / Internet
A função header() da PHP
A função header() é bastante interessante, pois envia para o servidor web
uma modificação do cabeçalho HTTP. Veja algumas implementações:
<?
/* Determina até quando o arquivo fica em cache */
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
/* Indica a última modificação do arquivo */
header("Last-Modified: " . gmdate('D,d M Y H:i:s') . ' GMT');
/* Indica que o arquivo não deve ficar em cache (força o seu reprocessamento) */
header("Cache-Control: no-cache, must-revalidate"); // ou
header("Pragma: no-cache");
/* Muda o tipo do arquivo */
header("Content-Type: image/gif");
/* Atacha o arquivo a resposta HTTP, bom para contadores de download */
header("Content-Disposition: attachment; filename=file.csv");
?>
/* Determina até quando o arquivo fica em cache */
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
/* Indica a última modificação do arquivo */
header("Last-Modified: " . gmdate('D,d M Y H:i:s') . ' GMT');
/* Indica que o arquivo não deve ficar em cache (força o seu reprocessamento) */
header("Cache-Control: no-cache, must-revalidate"); // ou
header("Pragma: no-cache");
/* Muda o tipo do arquivo */
header("Content-Type: image/gif");
/* Atacha o arquivo a resposta HTTP, bom para contadores de download */
header("Content-Disposition: attachment; filename=file.csv");
?>
Lendo a RFC HTTP (RFC2616) você irá descobrir muitas outras coisas.
O link para a documentação é: