上传到Heroku时如何访问Laravel符号链接 [英] How to access Laravel symbolic link when uploaded to Heroku

查看:73
本文介绍了上传到Heroku时如何访问Laravel符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作laravel Webapp,并尝试访问存储符号链接/storage/images/face-ph.png中的图像.

I'm making a laravel webapp and I'm trying to access a image in a storage symbolic link /storage/images/face-ph.png.

当我在本地这样做时,它可以工作:

It works when I do it locally like this:

<img src="/storage/images/face-ph.png>

但是,当我将其上传到Heroku时,却找不到路径.

However when I upload it to Heroku it can't find the path.

推荐答案

如果您使用Heroku进行部署,则可以尝试

if you are using Heroku for your deployment you can try

heroku run bash
php artisan storage:link

heroku run /app/php/bin/php /app/www/artisan storage:link

您可以使用绝对路径或相对路径来运行二进制文件

you can use an absolute path or relative path to run binaries

希望这会有所帮助

这篇关于上传到Heroku时如何访问Laravel符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆