日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php能不能动态显示html5,php – 是否可以动态生成html5缓存清单?

發布時間:2024/7/23 php 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php能不能动态显示html5,php – 是否可以动态生成html5缓存清单? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

解決方法:

很確定,但是讓我告訴你:讓HTML5離線內容與JavaScript applicationCache.update()等完美配合.人.如果你是新手,有點麻煩.最終一切都有效……記錄在案!但是CAVEAT LECTOR ……

無論如何,這是一個(希望)自我解釋的PHP專用示例,您需要一個.htaccess文件.這將告訴您的服務器將cache.manifest解釋為PHP代碼(因為沒有.php擴展名,所以需要).

您的.htaccss文件,以防您使用FCGI Wrapper:

AddType text/cache-manifest .manifest

SetHandler fcgid-script

FcgidWrapper /folder/to/your/php-fcgi-starter .manifest

Options +ExecCGI

你的.htaccess文件,以防你使用apache php模塊(大多數情況下,這將是默認情況):

AddType text/cache-manifest .manifest

SetHandler application/x-httpd-php

你的cache.manifest文件:

// only cache files in the following folders (avoids other stuff like "app/")

$folders = array('js', 'lib', 'views', 'styles');

$files = array('index.html');

// recursive function

function append_filelist(&$files, $folder) {

if ($dh = opendir($folder)) {

while (($file = readdir($dh)) !== false) {

if ( ! in_array($file, array('.', '..', '.svn')) &&

(substr($file, -4) != ".swp")) {

if (is_dir($folder."/".$file))

append_filelist($files, $folder."/".$file);

else

//$files[] = $folder."/".$file."?hash=".md5_file($folder."/".$file);

$files[] = $folder."/".$file;

} // if

} // while

} // if

}

// init

foreach ($folders as $folder)

if (is_dir($folder))

append_filelist($files, $folder);

// generate output

$body = "CACHE MANIFEST\n\nCACHE:\n";

foreach ($files as $file)

$body .= $file."\n";

$body .= "\nNETWORK:\n*\n";

// render output (the 'Content-length' header avoids the automatic creation of a 'Transfer-Encoding: chunked' header)

header('Content-type: text/cache-manifest');

header('Content-length: '.strlen($body));

echo $body;

祝好運!

標簽:php,html5,dynamic,cache-manifest

來源: https://codeday.me/bug/20190722/1507786.html

總結

以上是生活随笔為你收集整理的php能不能动态显示html5,php – 是否可以动态生成html5缓存清单?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。