Laravel默认使用 file 模式缓存
缓存文件位于 /storage/framework/cache/data 目录
当缓存文件过多时,可能导致系统崩溃无法访问
此时可以添加一个手动清除缓存的方法:
编辑路由文件 /routes/web.php , 添加如下内容:
// 刷新缓存URL 其中 *** 替换成实际项目路径Route::get('/***/flushcache/{string}',function($string){if ( $string == "FlushCacheFile") {Cache::store("file")->flush();dd( "清除缓存" );}});
这样就可以通过访问 https://_www.xxx.com/***_/flushcache/FlushCacheFile 来清除缓存文件了
