laravel Storage方法 如何读取/storage/logs下的logs文件

官方文档里光写了

$files = Storage::files($directory);
$files = Storage::allFiles($directory);

两个方法
但是压根没提这个目录路径到底是怎么指向的

ps: laravel官方文档写的真是shi一样,如果假设开发者什么都知道,那还写个jb毛的文档

阅读 11.9k
2 个回答

filesystems.php文件添加

'cache' => [
      'driver' => 'local',
      'root' => storage_path('framework/cache/data'),
],

控制器中增加Storage::disk('cache')->allFiles();

还请仔细阅读文档
https://laravel.com/docs/5.4/...
https://laravel.com/docs/5.4/...

local storage 的默认存储根目录是 ./storage/app ,与默认的 file cache 存储目录 ./storage/framework/cache/data 不相交,所以不能直接通过默认的 Storage 配置 操作日志文件。
不过可以通过修改这两个配置实现你要的功能。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题