问题
I'm trying to access files that are stored in storage/app/.../.../file.png.
I have created a symlink, linking my storage folder to public/storage.
When I try to access the appropriate file, my server throws a 404, saying file not found. Clearly I'm not accessing it the right way but I dont know what to change.
<img src="{{asset('storage/app/puppy/18/ax2Fk08nyWrV6TwTOnsXNCkNGuIdFebB7TTfPYGb.png')}}" alt="">
回答1:
when you create symlink in laravel
then it create symlink of storage/app/public
folder to public/storage
folder. That means if you want to access any files publicly then place all your files inside storage/app/public
folder and access it like this
<img src="{{asset('storage/puppy/18/test.png')}}" alt="">
Here it means the file test.png
should be physically at storage/app/public/puppy/18
folder.
Execute php artisan storage:link
for creating symlink in laravel
Hope it clear you
回答2:
Try this one.
<img src="{{asset('puppy/18/ax2Fk08nyWrV6TwTOnsXNCkNGuIdFebB7TTfPYGb.png')}}" alt="">
来源:https://stackoverflow.com/questions/51676037/laravel-storage-symlink