HTTP Headers {Cache Settings}

Discussion in 'PHP' started by adzeds, Aug 23, 2010.

  1. #1
    Hey,

    Was wondering if anyone knows the correct way to set up a simple cache using the PHP headers..

    Currently it is defaulting to no-cache and as it is a mobile site, we could really use the cache facility..

    Any help gratefully received!
     
    adzeds, Aug 23, 2010 IP
  2. andymoo

    andymoo Peon

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Had you actually bothered to RTFM you would have found this:

    // seconds, minutes, hours, days
    $expires = 60*60*24*14;
    header("Pragma: public");
    header("Cache-Control: maxage=".$expires);
    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
     
    andymoo, Aug 24, 2010 IP