如何在CodeIgniter中完全刷新页面? [英] How do I fully refresh the page in CodeIgniter?
问题描述
我正在叠加中加载表格。覆盖层对调用覆盖层的页面具有单独的控制器和操作。
I am loading a form in an overlay. The overlay has a separate controller and action to the page that invokes the overlay.
在表单提交中,如果成功,我只是想重新加载覆盖层所在的引用页面从加载。我可以加载引荐页,但会将内容放置在叠加层中。
On form submit, if successful, I simply want to reload the referring page that the overlay was loaded from. I can get the referring page to load, but it places the content inside the overlay.
header("Location: www.example.com", true, 302);
不起作用。
使用像这样的URL帮助器:
Using the URL helper like this:
$url = $_SERVER['HTTP_REFERER'];
redirect($url);
也不起作用。每次在叠加层中加载时。
Also does not work. Every time it loads in the overlay. I am sad because of it.
推荐答案
不幸的是,使用 header
刷新/重定向将仅反映显示PHP页面的容器中的更改。
Unfortunately, using header
to refresh/redirect will only reflect the changes in the container that is displaying the PHP page.
要刷新父页面(即显示覆盖本身的页面),您将需要使用Javascript在客户端进行操作。这些问题应该可以帮助您走上正确的道路:
To refresh the parent page (i.e. the page that is displaying the overlay itself), you will need to do it on the client-side using Javascript. These questions should help you get on the right path:
- Redirect parent window from an iframe action
- PHP "header (location)" inside IFRAME, to load in _top location?
这篇关于如何在CodeIgniter中完全刷新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!