php - Laravel中图像路径中的正斜杠问题
问题描述
在我的 Laravel 网站图像名称是
images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg
实际图像路径是http://localhost/fund/storage/app/images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg
但是在我的刀片模板中,当我使用此路径时,它会自动转换为
http://localhost/fund/storage/app/images%2Fcampaign%2F4965d649233e1436ece21804ff4eb62b.jpeg
这就是为什么我的图像没有显示。
刀片模板中的 Img src 代码
src="{{url('/storage/app',$response->large_image)}}"
为什么/
会被自动替换%2F
,如何解决?
有人帮忙吗?
解决方案
将刀片更改为以下内容:
src="{{url('/storage/app/'.$response->large_image)}}"
我已将逗号更改为一个点,它将图像的路径附加到该/storage/app
部分,因此它不会对最后一部分进行编码。
推荐阅读
- r - 获取数据集模式的前三个值
- web - 谷歌分析可以跟踪网站访问者的个人资料吗?
- reactjs - 仅在页面加载时轻松将数据加载到 React Form
- javascript - 使用 JavaScript 过滤和搜索数据
- python-3.x - pip3 不安装新版本的 pandas
- django - Django 从 POST 表单发送电子邮件
- javascript - selenium.common.exceptions.JavascriptException:消息:TypeError:document.getElementsByClassName(...)[0] 未定义
- python - Python:没有 mksalt 了吗?
- kubernetes - 从 GitLab CI 作业向 Kubernetes Pod 发送信号
- html - 如何创建 if else 语句以从角度删除项目