版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sdutphp/article/details/84638981
背景:在A页面中提交表单后,跳转至结果页B,在B页单击浏览器的后退按钮,回到A页面时,希望保留上次A页面的查询条件。
框架:ThinkPHP 3.2.3
核心代码:
C('HTTP_CACHE_CONTROL', 'private, max-age=0, no-store, no-cache, must-revalidate');
header("Expires: Thu, 04 Jan 2018 08:00:00 GMT");
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
如果未使用PHP框架,应修改为:
header("Expires: Thu, 04 Jan 2018 08:00:00 GMT");
header('Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');