首页 > 解决方案 > 图片未显示在网页上(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

有人可以解决这个问题,这很重要。谢谢

标签: phplaravellaravel-bladelaravel-routinglaravel-8

解决方案


这是 src 问题,然后我尝试添加完整地址,例如:

<img src="/Complain-Management-System/public/images/{{ Auth::user()->image }}" class="rounded-circle" width="130" height="130" alt="">

它有效!


推荐阅读