You are here: PHP Headers (caching) « PHP Language « IT news, forums, messages
PHP Headers (caching)

Posted by Jure Erznoznik on 06/20/05 10:23

I modified some of my javascript files to be PHP because I needed
translation (different languages for strings).
Of course, the files get translated fine, but I would like the browser to
keep them in cache, not reload them every single time.

Non-caching is triggered by headers Pragma, expires, etc, which I am
currently solving with this code:
<?php
session_start();
header("Content-type: text/javascript");
// Header("Expires: " . gmdate("D, d M Y H:i:s", mktime(5, 0, 0, 1, 1,
2020)) . " GMT");
Header("Expires: ");
Header("Cache-control: max-age=86400");
Header("Pragma: ");

This enables the browsers to recognise files as valid for 1 day, which is
good enough for me.

Is there a better way? How can I simply disable the Expires and Pragma
headers instead of setting them blank? I searched the manual all over but
can't find any function that would do this.

Thanks,
Jure

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация