php使用header設定瀏覽器快取

2021-07-14 13:54:31 字數 666 閱讀 5260

<?php 

//定義乙個合理快取時間。合理值屈居於頁面本身、訪問者的數量和頁面的更新頻率,此處為3600秒(1小時)。

//傳送last-modified頭標,設定文件的最後的更新日期。

header ("last-modified: " .gmdate("d, d m y h:i:s", time() )." gmt");

//傳送expires頭標,設定當前快取的文件過期時間,gmt格式,我們使用的是gmt+8時區

header ("expires: " .gmdate("d, d m y h:i:s", time()+$cache_time )." gmt");

//傳送cache_control頭標,設定xx秒以後文件過時,可以代替expires,如果同時出現,max-age優先。

header ("cache-control: max-age=$cache_time");

echo time();

?>

php中header函式的使用

header http 1.0 400 bad request 返回400錯誤 header http 1.0 404 not found 返回404錯誤 header location http host uri extra 跳轉 設定nocache 過期 1。php header 函式 網上很多...

Feign設定動態header

feign動態設定header feign設定全域性header feign 呼叫介面是經常會忘header資訊,再次介紹兩種忘header裡面新增資訊的方式 1.通過直接在請求上,或者在類上新增headers的註解 headers value card blank batch create res...

php常用header狀態

200 正常狀態 301 永久重定向,記得在後面要加重定向位址 location url 重定向,其實就是302 暫時重定向 header location 設定頁面304 沒有修改 顯示登入框,header www authenticate basic realm 登入資訊 echo 顯示的資訊!...