PHP 重定向强制刷新 (CTRL+F5) [英] PHP Redirect that force refresh (CTRL+F5)
问题描述
我有一个带有可编辑表格的页面.我需要用户能够编辑它,然后提交他们的更改.一切正常,直到我将它们重定向到具有新内容(与它们的更改相关)的同一页面.但是,他们看到的是旧内容.
I have a page with an editable table. I need users to be able to edit this and then submit their changes. Everything works well until I redirect them to the same page with new content (relevant to their changes). However, they see the old content.
如果我在浏览器上按 ctrl+f5,它们的内容就会更新.我想知道是否有办法强制执行此操作.这是我的 php 代码,它无助于强制刷新:
If I press ctrl+f5 on the browser, they content gets updated. I was wondering if there is a way to force this. This is my php code which does not help force refreshing:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');
header( 'Location: http://www.bamozir.com/en/mtl-en/recent/general-info/cost#edit' );
Eugen Rieck 解决方案适用于 Firefox、Chrome 和 Safari.但不是在 IE 和 Opera 上.知道如何解决这个问题吗?
Eugen Rieck Solution works perfect for firefox, chrome, and safari. But not on IE and Opera. Any idea how to fix this?
推荐答案
什么总是有效:假设您的 URL 是 http://my.server/my/page?a=b&c=d 你重定向到 http://my.server/my/page?a=b&c=d&nocache=1234567890 1234567890 是一个大随机数号码
What ALLWAYS works: Assuming your URL is http://my.server/my/page?a=b&c=d you redirect to http://my.server/my/page?a=b&c=d&nocache=1234567890 with 1234567890 being a large random number
这篇关于PHP 重定向强制刷新 (CTRL+F5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!