久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 PHP 文件中使用 etags?

How to use etags in a PHP file?(如何在 PHP 文件中使用 etags?)
本文介紹了如何在 PHP 文件中使用 etags?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

你如何在 PHP 文件中實(shí)現(xiàn) etags?我要上傳什么到服務(wù)器,我要在 PHP 文件中插入什么?

How do you implemented etags inside a PHP file? What do I upload to the server and what do I insert into my PHP file?

推薦答案

創(chuàng)建/編輯您的 .htaccess 文件并添加以下內(nèi)容:

Create / edit your .htaccess file and add the following:

FileETag MTime Size

將以下內(nèi)容放在函數(shù)中或?qū)⑵浞旁谛枰?etags 處理的 PHP 文件的頂部:

Either place the following inside a function or put it at the top of the PHP file that you need etags to work on:

<?php 
    $file = 'myfile.php';
    $last_modified_time = filemtime($file); 
    $etag = md5_file($file); 

    header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT"); 
    header("Etag: $etag"); 

    if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || 
        trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { 
        header("HTTP/1.1 304 Not Modified"); 
    exit; 
} 
?>

這篇關(guān)于如何在 PHP 文件中使用 etags?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 久久精品高清视频 | 日本久久精 | 九九热在线视频观看这里只有精品 | 亚洲一区视频在线播放 | 成人在线免费观看av | 欧美精品国产一区二区 | 国产色爽 | 精久久久久 | 波多野结衣一区二区 | 国产成人午夜精品影院游乐网 | 久久久久久免费精品一区二区三区 | 日韩美女一区二区三区在线观看 | 久久久91精品国产一区二区三区 | 亚洲天堂二区 | 夜操 | 91在线视频国产 | 国产农村妇女精品一区 | 成人av播放 | 国产精品视频在线观看 | 中文字幕视频在线 | 一区二区福利视频 | 免费电影av | 成人精品一区二区三区 | 久久久一区二区三区 | 亚洲 欧美 另类 综合 偷拍 | 免费久草 | 精品在线一区二区三区 | 日日夜精品视频 | 久久草视频 | 国产在线观看免费 | 另类在线 | 国产成人a亚洲精品 | 亚洲成人免费 | 国产xxxx岁13xxxxhd | 久久久久久久av | 亚洲视频www | 伊人网综合在线 | 中文字幕在线第一页 | 久久亚洲天堂 | 91精品一区 | 欧美午夜精品 |