Php 从存储文件夹访问图像

Php 从存储文件夹访问图像,php,laravel,Php,Laravel,我将图像上传到存储文件夹storage/app/public,但我还添加了其他文件夹,以更有用的方式存储它们 C:\xampp\htdocs\rps\storage\app\public\images\user profile 我成功地保存了它们,但现在我不知道如何在我尝试的.blade.php文件中访问它们: src="storage/images/user-profile/standard/default.png" C:\xampp\htdocs\rps\storage\app\publi

我将图像上传到存储文件夹storage/app/public,但我还添加了其他文件夹,以更有用的方式存储它们

C:\xampp\htdocs\rps\storage\app\public\images\user profile

我成功地保存了它们,但现在我不知道如何在我尝试的.blade.php文件中访问它们:

src="storage/images/user-profile/standard/default.png"
C:\xampp\htdocs\rps\storage\app\public\images\user profile\standard\default.png

C:\xampp\htdocs\rps\storage\app\public\images\user profile\standard\1558700163.jpg

但这对我不起作用,任何人都可以帮忙。我想我的路错了


是否还需要添加公用/存储文件夹?

config/filesystems.php
中配置新磁盘,如下所示:

'images' => [
    'driver' => 'local',
    'root' => storage_path('images'),
],
然后,要获取URL:

$url = Storage::disk('images')->url('file.jpg');
要获取文件内容,请执行以下操作:

$contents = Storage::disk('images')->get('file.jpg');
您还可以使用
storage\u path()
helper。因此,在您看来,这应该是可行的:

src="{{storage_path('images/user-profile/standard/default.png')}}"

阅读以了解更多信息。

如果您将存储助手与公共存储磁盘一起使用,您还可以获得{asset('images/user profile/standard')。/'.$person->avatar}}网站上没有显示静态图片,我认为src完美地显示了图片的路径,但静态图片没有显示出来(我的本地路径C:\xampp\htdocs\rps\storage\app\public\images\user profile\standard\1558704557.jpg)404找不到error@S0ul3r
存储路径()
helper应在返回绝对路径时工作。除非使用
php artisan storage:link
@Archie将符号链接添加到
/public
,否则URL将无法工作。不幸的是,我已将符号链接添加到/public。两个存储路径()IRL对我不起作用。但是如果我像这样使用src-to-public路径,一切都会按预期显示:
C:\xampp\htdocs\rps\public\files\assets\images\user profile\standard
src=“/files/assets/images/user profile/standard/{{{$person->avatar}”
@S0ul3r
storage\u-path()
实际返回什么?
src="{{storage_path('images/user-profile/standard/default.png')}}"