Caching image requests through PHP - If-Modified-Since not being sent

前端 未结 5 1265
星月不相逢
星月不相逢 2021-01-13 08:33

I am serving images through php and having some problems setting it up to respond with 304 headers to save on load time.

Most of the code below I found on php.net. I

5条回答
  •  轮回少年
    2021-01-13 09:12

    I believe it should be

    if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) >= $file_time)) {
    

    Checking if the modified time is greater than or equal rather than just equal. Although I do understand the two values should be the same.

提交回复
热议问题