Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome 在Laravel中注销后如何清除缓存_Google Chrome_Caching_Laravel 5 - Fatal编程技术网

Google chrome 在Laravel中注销后如何清除缓存

Google chrome 在Laravel中注销后如何清除缓存,google-chrome,caching,laravel-5,Google Chrome,Caching,Laravel 5,这是一个常见的问题。当我注销并单击浏览器后退按钮时,浏览器将显示网站上最后加载的页面 我已经浏览了堆栈上的很多链接,其中大多数都建议在注销时清除标题,但都不起作用 这是我尝试过的代码 Route::get('main/logout',function(){ Session::flush(); Auth::logout(); header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1. header

这是一个常见的问题。当我注销并单击浏览器后退按钮时,浏览器将显示网站上最后加载的页面

我已经浏览了堆栈上的很多链接,其中大多数都建议在注销时清除标题,但都不起作用

这是我尝试过的代码

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" />

如果你们有什么想法,请告诉我


谢谢

您必须在用户返回的页面上包括以下行,而不是实际的注销页面:

header("Cache-Control: no-cache, no-store, must-revalidate");
但这样做会失去浏览器缓存的优势,在大多数情况下,这不是一件好事。别管它了。用户在注销后仍然无法与服务器交互,只能检索他已经看到的数据。

试试这个

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-Type: text/html');

在注销函数中清除缓存,将此代码放在那里

Artisan::call('cache:clear');