php - 图片未显示在网页上(Laravel)
问题描述
存在路由问题或图像地址问题。该图像未显示在某些页面上,但显示在某些页面上:
这是未显示图像的路由地址:
Route::get('users/edit/{id}', [App\Http\Controllers\UserController::class, 'edit'])->name('edit-user');
这是这条路线的图片地址:
http://localhost/Complain-Management-System/public/users/edit/images/1312455072.jpg
这是刀片上的图像源:
<img src="images/{{ Auth::user()->image }}" class="rounded-circle" width="130" height="130" alt="">
这条路线上的图像显示良好:
Route::get('users', [App\Http\Controllers\UserController::class, 'index'])->name('manage-user');
这条路线的图片网址是:
http://localhost/Complain-Management-System/public/images/1312455072.jpg
有人可以解决这个问题,这很重要。谢谢
解决方案
这是 src 问题,然后我尝试添加完整地址,例如:
<img src="/Complain-Management-System/public/images/{{ Auth::user()->image }}" class="rounded-circle" width="130" height="130" alt="">
它有效!
推荐阅读
- c++ - Cmake - 为 iOS 交叉编译 C++ 项目
- spring-boot - 未从 Spring Boot API 报告的新 Relic 事务
- vue.js - 有人请解释一下 now 的用途以及它是如何在这里工作的
- powerbi - 刷新power bi桌面时获取“断点已达到断点”
- azure - 使用特定规则请求应用程序时重写主机 - Azure 应用程序网关
- java - 在 Java 中访问 JSON 对象的单个元素时是否必须使用 toString()
- elasticsearch - Elasticsearch 将索引作为 Header 而不是 URL 参数传递
- node.js - 如何从节点 js 中的网页中提取图像?
- c++ - 具有 noexcept(false) 的析构函数的类可以从具有 noexcept(true) 的析构函数的基类继承吗
- javascript - Vue FireStore 反应式键分配 - 对象可能是“未定义”