【发布时间】:2020-05-19 01:13:43
【问题描述】:
我用php artisan storage:link 创建了一个存储链接,它在localhost 上运行良好,但是,当我在共享主机上部署我的项目时,它不会呈现任何图像。这是我的托管目录结构:
- home2/username
: + other hosting folders
: - MyLaravelWebSite
: : + other_laravel_folders
: : - storage
: : : - app
: : : : - public
: : : : : -images
: : : : : : * some-image.jpg
: : : : * gitignore
: : : + framework
: : : + logs
: - public_html
: : + assets
: : + storage // symlink
: : * index.php
图片上传没有任何问题,但是当我尝试渲染它们时它们没有渲染,而它们在本地主机上被渲染得非常好。我认为 符号链接 不起作用。我怎样才能让它发挥作用?
P.s:我在 cPanel 上没有 CLI 的任何访问权限。
【问题讨论】:
-
您在
.env文件上的APP_URL是什么?是你项目的网址吗? -
@hasan05 这是
APP_URL=http://localhost -
那么,您的图片实际上传到了哪里?我认为它在您的 public_html 文件夹中。所以,你必须改变
APP_URL=${your current url} -
不,它正在上传
storage>app>public>images,就像它应该上传一样。只是每当我尝试使用asset('storage/path/to/image.jpg');时,符号链接都不起作用...... -
你试过更改
APP_URL吗?
标签: laravel storage hosting cpanel laravel-storage