用PHP驱动的网站进行html5离线缓存 [英] html5 offline caching with php driven sites

查看:71
本文介绍了用PHP驱动的网站进行html5离线缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的PHP驱动的网站正在运行,我试图弄清楚它如何处理php页面。我的一些php文档是路由逻辑,一些只包含单个页面。我怎样才能使这项工作脱机?



我的是,我不得不在javascript中重新创建路由逻辑。这是我唯一的选择吗?在那种情况下,甚至有可能在网上使用php驱动网站,并在线下切换到JS?如果您的网站相当静态,那么HTML5的缓存清单可能会让您获得大部分的内容。

在那里。让PHP以正确的格式输出一个cache.manifest文件,其中包含所有路由系统的URL,这些URL将本地存储在兼容的浏览器中。如果可能的话,尝试访问它们会将它们从缓存中提取出来。



然而,如果您正在寻找更有活力的东西,那么您将不得不做更多的事情legwork。



下面是关于离线缓存的一些很好的信息。


I have a simple php driven website running and I'm trying to figure out how it treats php pages. Some of my php documents are routing logic and some just includes for individual pages. How do i go about making this work offline?

What I though was that I'd have to re-create the routing logic in javascript. Is that my only option? In that case, is it even possible to have the site be driven by php while online and switch to JS offline? I can't make sense of it.

解决方案

If your site is fairly static, HTML5's cache manifest may get you most of the way there. Have PHP output a cache.manifest file in the correct format with all your routing system's URLs and those URLs will be stored locally in a compliant browser. Attempting to access them will pull them out of the cache if possible.

If you're looking for something more dynamic, though, you're going to have to do more legwork.

Here's some good info on offline caching.

这篇关于用PHP驱动的网站进行html5离线缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆