【发布时间】:2020-05-13 05:15:09
【问题描述】:
这是一个常见的问题。当我注销然后单击浏览器后退按钮时,浏览器会显示网站最后加载的页面。
我浏览了堆栈上的许多链接,其中大多数建议在注销时清除标题,但没有成功。
这是我尝试过的代码
Route::get('main/logout',function(){
Session::flush();
Auth::logout();
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.
session()->flash('alert-success', 'Success logged out');
return Redirect::to('/');
});
更新
我也尝试将其添加到我的 APP.blade.php 文件的标题中
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="cache-control" content="must-revalidate" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
如果你们有任何想法,请告诉我
谢谢
【问题讨论】:
标签: google-chrome caching laravel-5