Storage::download 在 laravel 5.7 中工作出错

Storage::download working wrong in laravel 5.7

我在路径中有一个文件:

app/public/template/templateeSkillsMatrix_Config.docx

当我使用时:

return response()->download(storage_path('app/public/template/eSkillsMatrix_Config.docx'));

它正在工作,但是当我使用时:

return Storage::download(storage_path('app/public/template/eSkillsMatrix_Config.docx'));

显示错误:

File not found at path: E:/project/agl/nav/New folder/DKMH/storage/app/public/template/eSkillsMatrix_Config.docx

我不知道为什么。 我看了 laravel docs ,但我不明白它的参数是什么。

请帮忙!

就像@apokryfos 的评论一样,Storage::download(..) 将自动使用基本存储路径,所以我不需要调用 storage_path 方法。我需要这样称呼它:

return Storage::download('public\template\eSkillsMatrix_Config.docx');

在这一行中,我删除了 storage_path 方法并删除了路径中的 app/。

它对我有用!