使用 zend 缓存整个 html 输出 [英] Caching whole html output with zend

查看:26
本文介绍了使用 zend 缓存整个 html 输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Zend_Cache 缓存布局脚本和控制器动作脚本输出的所有内容,但它无法正常工作.我得到的只是

I am trying to cache everything that is output by layout script and controller's action script using Zend_Cache but it is not working correctly. All I get is

调试头:这是一个缓存页面!

DEBUG HEADER : This is a cached page !

我得到了 layout.phtml 脚本和 index.phtml 脚本.两者都产生 html 代码.在我的 IndexController 我把

I got layout.phtml script and index.phtml script. Both produce html code. In my IndexController i put

        $frontendOptions = array(
       'lifetime' => 7,
       'debug_header' => true,
       'regexps' => array(
           '^/$' => array('cache' => true),
           '^/index/' => array('cache' => true)
       )
    );

    $backendOptions = array('cache_dir' => '../application/cache/');

    $cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);

    if(!$cache->start('mypage')) {
    }

如何让它工作?我希望 html 代码应该保存在缓存文件夹中.

How to get it working? I expect that html code should be saved in cache folder.

推荐答案

查看本教程 Brandon Savage on Zend Cache,很短,我认为它比 ZF 文档更新.

check this tutorial out Brandon Savage on Zend Cache, it's short and I think it's more current then the ZF docs.

这篇关于使用 zend 缓存整个 html 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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