具有GET参数的Codeigniter页面缓存 [英] Codeigniter Page cache with GET parameter

查看:40
本文介绍了具有GET参数的Codeigniter页面缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是CI缓存的新手。我在Codeigniter页面缓存中遇到了一些奇怪的问题。 $ this-> output-> cache(300);
我期望如果 GET中的参数不会加载缓存的版本[] 将更改。但是它正在加载缓存,而没有考虑任何 GET [] 参数。

I am newbie to CI cache. I am facing some weird problem with codeigniter page caching. $this->output->cache(300); I was expecting that cached version would not load if arguments in GET[] would change. But it is loading cache without considering any GET[] parameters.

我有一页显示是否评论是否已保存(通过get参数),
/ product / product-name /?saved = true 重定向到评论表单所在的页面。但这是行不通的。如何根据get参数使旧的缓存无效并创建新的缓存?还是我需要更改评论系统的行为?

I have one page where it says whether comment has been saved or not [via get parameter], /product/product-name/?saved=true redirecting to same page where comment form is located. But it is not working. How can i invalidate old cache and create new one depending upon the get parameter? or i need to change the behavior of my comment system?

谢谢。

编辑

我应该只使用数据库缓存而不是网页缓存在这种情况下?

Should i simply use database cache instead of Web page cache in this case?

推荐答案

您只需要启用 cache_query_string config / config.php 文件中的$ c>选项。

You just have to enable the cache_query_string option in the config/config.php file.

$config['cache_query_string'] = TRUE;

这篇关于具有GET参数的Codeigniter页面缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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