[英]Laravel Voyager not showing images
我在 godaddy.com(共享主机)上使用 installatron 创建了一个 Laravel 应用程序。 安装 Voyager 后,默认管理员头像未显示。 存储链接由 Voyager 自动创建。 但是当我打开管理面板时,voyager 尝试从[app_url]/storage/users/default.png获取管理员头像并收到 404。头像位于[app_url]/public/storage/users/default.png
版本: Laravel: 5.8航海者: 1.3
如果使用 localhost,请将端口号放入 .env 文件中
APP_URL=http://localhost:port_number
我之前遇到过完全相同的问题,在检查 APP_URL 之后,继续执行
php artisan config:clear
之后再试一次。
如果不起作用,请删除 public/ 中的符号链接存储并执行
php artisan storage:link
请检查您的 .env 文件中的 APP_URL 是否正确。
它等于您在 godaddy 购买的域名以及协议(HTTP 或 HTTPS)。
只需将 'APP_URL' 变量更改为 .env 文件到您的 localhost 路由。
例如:
APP_URL=http://127.0.0.1:8000
我今天面临这个问题
在我的情况下 3 个步骤:
1- .env 文件中的正确 App_URL(不要忘记端口号)示例:
APP_URL=http://127.0.0.1:8000
2- 从 [项目路径]\public 中删除存储文件
3-运行: php artisan storage:link
请享用:)
我在本地尝试将端口添加到APP_URL
解决了我的问题。 但在服务器问题是公共目录中的“存储”文件夹。
2022 年 2 月更新,请注意符号链接必须存在于您的根目录中
在您的 .env 文件中,替换应用 URL。
APP_URL=http://localhost:port
我不得不更改filesystems.php
中的设置。
'url' => env('APP_URL').'/nameOfMyRootFolder/storage/app/public',
然后它能够正确解析图像链接。
更改 filesystems.php 中的设置,disks -> public -> "url => env('APP_URL').'/public/storage'"
请检查 .env 文件中的 APP_URL=<> 它应该基本上像
APP_URL=http://localhost:8000
检查 .env 文件中的 APP_URL,确保 .env 文件中的 APP_URL 指向您项目的公共文件夹
APP_URL=http://localhost/your-project-name/public/
APP_URL 设置对我有用。 我在容器中运行应用程序,所以我必须把我的主机使用的端口不是 8000。我有端口 8000 映射到 8186,所以我必须把 APP_URL=http://localhost:8186
如果您使用的是sails,请尝试运行:
sail artisan storage:link
为我工作:
图片见 url http://localhost:8000/storage/users/default.png
但不在 /admin 面板中(http://localhost/storage/users/default.png 404)
这是存储的端口问题
将配置/应用更改为
'url' => env('APP_URL', 'http://localhost:8000')
如果您仍然想知道为什么,请查看航海者问题中的这个答案
由于在 Laravel 中默认未定义 FILESYSTEM_DRIVER,因此使用公共存储,但在 Laravel 8.5.19 中添加了默认值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.