Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
702 views
in Technique[技术] by (71.8m points)

php - Fetch Laravel Storage files that are in the storage/folder directory not in storage/app/directory

I'm attempting to pull in a certs file from the directory /storage/certs/certexample.pem in my laravel 6 application.

Whenever I try to run the command:

Storage::get('storage/certs/certexample.pem'))

or use

storage_path('certs')

to fetch the full path I get the error:

LeagueFlysystemFileNotFoundException: File not found at path:

The file does exist and I can cat it out on the terminal so there must be something I'm missing.

My filesystem config looks like this:

'disks' => [
       'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

I've tried adding in another disk called 'certs' that has storage_path('certs') set however this doesn't seem to help.

Since the file is only ever placed on the server and the app isn't writing it I don't need to write the file using Storage as I've seen in the docs. Is there a way to pull the certsexample.pem file (or a similar file) in this manner or am I missing something with Laravel's Storage functionality?

Update: After attempting to get a folder to be accessed outside of storage/app with no luck I ended up using the sotrage/app/certs directory and accessing it with storage_path('app/certs').


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...