简体   繁体   English

php force page重新加载包括

[英]php force page to reload includes

I am developing a website with php jquery Sass bootstrap etc etc 我正在开发一个带有php jquery Sass bootstrap等的网站

The way I have it set up, I have one index page that has all of the includes for the header, css files and js files, and different pages are loaded with a SESSION variable that tells the index what page to include (and there is also a helper page that reads GET variables and stores them in the session and redirects back to the index). 我设置它的方式,我有一个索引页面,其中包含头,css文件和js文件的所有包含,并且不同的页面加载了一个SESSION变量,该变量告诉索引要包含哪个页面(并且有也是一个帮助页面,它读取GET变量并将它们存储在会话中并重定向回索引)。

I noticed that if I add a new include or change an include on the index page I have to close the tab and open it again in a new one in order for that to take effect. 我注意到,如果我在索引页面上添加新的include或更改include,我必须关闭该选项卡并再次以新的方式打开它以使其生效。 It's not a huge deal, but its wasting a lot of my time trying to find errors that don't exist. 这不是什么大不了的事,但它浪费了我很多时间来寻找不存在的错误。

Anyone have any ideas of what would be causing this?\\ 任何人都有什么想法会导致这个?

EDIT: I realized that this problem occurs with every change I make to the css files (but not the php files) and logging out of my site and logging back in will show the changes, so I don't actually have to close the page. 编辑:我意识到这个问题发生在我对css文件(但不是php文件)的每次更改和登出我的网站并重新登录将显示更改,所以我实际上不必关闭页面。 It seems like an issue with the SESSION. 这似乎是SESSION的一个问题。 I also thought it might have to do with the header(location:) command since your not supposed to use it with in the body of html, so i switched it to echo '<script type="text/javascript">window.location.replace();</script>'; 我还认为它可能与header(location:)命令有关,因为你不应该在html的主体中使用它,所以我把它切换到echo '<script type="text/javascript">window.location.replace();</script>'; and that didn't fix it either. 而这也没有解决它。 Also added: 还添加了:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

to my header.php file and that didn't solve it either. 到我的header.php文件,并没有解决它。

It appears that apache2 was caching these files. 似乎apache2正在缓存这些文件。 I added some lines to my apache2.conf file telling it not to cache this specific site and so far so good. 我在apache2.conf文件中添加了一些行,告诉它不要缓存这个特定的站点,到目前为止一直很好。 I will update again if it turns out this wasn't a fix and it only started working temporarily. 如果事实证明这不是一个修复,我会再次更新,它只是暂时开始工作。

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

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