【发布时间】:2021-04-07 20:57:56
【问题描述】:
我正在尝试从我的 laravel 6 应用程序的目录 /storage/certs/certexample.pem 中提取一个证书文件。
每当我尝试运行命令时:
Storage::get('storage/certs/certexample.pem'))
或使用
storage_path('certs')
要获取完整路径,我得到了错误:
League\Flysystem\FileNotFoundException: File not found at path:
该文件确实存在,我可以在终端上找到它,所以一定有我遗漏的东西。
我的文件系统配置如下所示:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
我尝试添加另一个名为“certs”的磁盘,该磁盘设置了 storage_path('certs') 但这似乎没有帮助。
由于文件只放置在服务器上并且应用程序没有写入它,因此我不需要使用存储来写入文件,正如我在文档中看到的那样。有没有办法以这种方式提取 certsexample.pem 文件(或类似文件),还是我缺少 Laravel 的存储功能?
更新: 在尝试获取要在 storage/app 之外访问的文件夹但没有成功后,我最终使用了 sotrage/app/certs 目录并使用 storage_path('app/certs') 访问它。
【问题讨论】: