简体   繁体   English

您可以强制PHP包含不与页面一起缓存吗?

[英]Can you force a PHP include to not be cached with a page?

I have this PHP include on my website's homepage. 我的网站主页上包含此PHP。

<?php include($_SERVER['DOCUMENT_ROOT'].'/streams/streamers.php'); ?>

I want to make it so when it pulls that PHP page, it always pulls it fresh from the server. 我要这样做,以便当它拉出PHP页面时,总是将其从服务器中拉出。

I have looked all over to try to see if this is possible. 我四处张望,尝试看看是否可行。

Thank you for your time. 感谢您的时间。 It is very much appreciated. 这是非常赞赏。

Browser is who decides to cache your request or not. 浏览器是决定是否缓存您的请求的人。

To define if a page should be or not cached, you must use .htaccess or set that page has been modified in http headers. 若要定义是否应缓存页面,必须使用.htaccess或在http标题中设置该页面已被修改。

PHP execute that file. PHP执行该文件。 It does not cache its response. 它不缓存其响应。 The final response it can or it can not be cached by the browser. 浏览器可以或不能缓存最终响应。 Add this line to tell the browser not to cache your page. 添加此行以告知浏览器不要缓存您的页面。

header("Cache-Control: no-cache, must-revalidate");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM