[英]Skip/ bypass the SERVER cache file/caching if there's a query string in the url?
I have a home page as index.php
and it gives a list of 10 items/ products. 我有一个主页作为
index.php
,它提供了10个项目/产品的列表。
Now, I am using the same page as landing page for inward traffic from facebook. 现在,我使用与登陆页面相同的页面来接收来自Facebook的内向流量。 The url looks like
index.php?productID=Q231
This page displays the product carrying the specified ID only. 网址看起来像
index.php?productID=Q231
此页面仅显示带有指定ID的产品。
I am aware of PHP output caching but I am new. 我知道PHP输出缓存,但是我是新手。 I have learned that if I cache
index.php
, it will serve the same cached file to all the inward traffic from facebook. 我了解到,如果我缓存
index.php
,它将为来自Facebook的所有传入流量提供相同的缓存文件。
I would greatly appreciate if anyone could give me some pointers. 如果有人可以给我一些指导,我将不胜感激。
It really depends on your caching model and how you handle this in your code. 它实际上取决于缓存模型以及如何在代码中处理它。
If you are creating the whole thing using output buffering you may want to use a method such as: 如果要使用输出缓冲创建整个内容,则可能需要使用以下方法:
Googling brings up this rudimentary example: http://www.devshed.com/c/a/PHP/Output-Caching-with-PHP/ Googling提出了这个基本示例: http : //www.devshed.com/c/a/PHP/Output-Caching-with-PHP/
if i'm not mistaken caching is not based on referrer. 如果我没记错的话,缓存不是基于引荐来源网址。 Internal php caching is only to optimize code, it will not cache, as ie.
内部php缓存仅用于优化代码,因此不会缓存。 'external' caching systems, like inbuild caching in smarty for example, output.
“外部”缓存系统,例如smarty中的内置缓存,例如输出。 I think you'd only need to 'disable' caching for browsers, which will mean, send the proper headers with
header(...)
我认为您只需要为浏览器“禁用”缓存,这意味着发送带有
header(...)
的正确标题
You are using output caching. 您正在使用输出缓存。 Then you should clear cache when your facebook or twitter links called.
然后,当您的facebook或twitter链接被调用时,您应该清除缓存。 IN codeigniter(Framework of PHP), I have done this by clearing cache.
在codeigniter(PHP框架)中,我通过清除缓存来完成此操作。
In core PHP, I don't know how to clear cache. 在核心PHP中,我不知道如何清除缓存。 But there must be some methods to clear cache.
但是必须有一些清除缓存的方法。 So try for that.
因此尝试。
Here some links may be useful to you. 这里有些链接可能对您有用。
How to clear browser cache with php? 如何使用php清除浏览器缓存?
http://php.net/manual/en/function.clearstatcache.php http://php.net/manual/zh/function.clearstatcache.php
http://www.dreamincode.net/forums/topic/6519-clear-cache/ http://www.dreamincode.net/forums/topic/6519-clear-cache/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.