在我的 Laravel 网站图像名称是
images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg
实际图片路径为http://localhost/fund/storage/app/images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg
但是在我的 Blade 模板中,当我使用这个路径时,它会自动转换成
http://localhost/fund/storage/app/images%2Fcampaign%2F4965d649233e1436ece21804ff4eb62b.jpeg
这就是我的图片没有显示的原因。
blade模板中的img src代码
src="{{url('/storage/app',$response->large_image)}}"
为什么/
会自动被%2F
替换,如何解决?
有人帮忙吗?
最佳答案
将 Blade 更改为以下内容:
src="{{url('/storage/app/'.$response->large_image)}}"
我已将逗号更改为点,它将图像的路径附加到 /storage/app
部分,因此它不会对最后部分进行编码。
关于php - Laravel 图像路径中的正斜杠问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55619821/