Php Laravel-图像未加载到生产服务器中,在本地服务器中工作正常
我对laravel的工作还很陌生,我只是不太明白它是如何处理文件的。我按照文档中的说明,按照说明使用了Php Laravel-图像未加载到生产服务器中,在本地服务器中工作正常,php,laravel,laravel-5,laravel-5.5,Php,Laravel,Laravel 5,Laravel 5.5,我对laravel的工作还很陌生,我只是不太明白它是如何处理文件的。我按照文档中的说明,按照说明使用了php artisan storage:link,但没有成功。我甚至无法通过转到图片在我的url中的位置来查看它们 这是我的config/filesystems文件: <?php return [ /* |-------------------------------------------------------------------------- | Default Filesy
php artisan storage:link
,但没有成功。我甚至无法通过转到图片在我的url中的位置来查看它们
这是我的config/filesystems
文件:
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
'img' => [
'driver' => 'local',
'root' => storage_path('images')
],
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
];
您在刀片模板中使用的资产
帮助程序为您提供公共
资产的路径,即位于Laravel应用程序的公共
文件夹中的资产。您的静态资产(如徽标、背景图像等)应保存在您的公共
目录中,您的应用程序就是从该目录提供服务的
存储
目录通常用于应用程序中用户上载的资产,例如用户上载新的配置文件图片。要获取存储路径,可以使用helper函数检索路径。或者,您可以使用该方法检索存储路径的完整URL。您是否能够列出公用文件夹中的图像?(ls公共/存储/图像/图标)。如果图像在那里,我认为主机中的重定向模块可能有问题如果这些是静态资产(未上载),您可以将它们保存在根/public/images
中,并使用
显示它们。还可以检查生产服务器,从project rootls-l public/| grep storage
查看符号链接是否在那里这是该命令返回的结果:lrwxrwx 1 agdpc941 agdpc941 49 Oct 19 15:57 storage->/home/agdpc941/public\u html/vbi/storage/app/public/
t看起来不错。使用ls-l public/storage/
<img src="{{asset('storage/images/icons/icon.png')}}">