Php 希望通过提供其路径来显示图像,但页面未显示图像,尽管路径正确
代码显示的是DB的内容,只有图像不显示Php 希望通过提供其路径来显示图像,但页面未显示图像,尽管路径正确,php,html,mysql,laravel,Php,Html,Mysql,Laravel,代码显示的是DB的内容,只有图像不显示 <table> <thead> <tr> <th>ID</th> <th>Name</th> <th>Password</th> <th>Image</th>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Password</th>
<th>Image</th>
</tr>
</thead>
<tr>
@foreach($users as $user)
<td>{{$user->id}}</td>
<td>{{$user->email}}</td>
<td>{{$user->password}}</td>
<td> <img src="storage/app/fileToUpload/{{ $user->pic }}" style="height:100; width:100" /></td>
</tr>
@endforeach
<input type="hidden" value={{csrf_token()}} name=_token>
</table>
身份证件
名称
暗语
形象
@foreach($users作为$user)
{{$user->id}
{{$user->email}
{{$user->password}
pic}“style=”高度:100;宽度:100“/>
@endforeach
唯一的问题是:
<td> <img src="storage/app/fileToUpload/{{ $user->pic }}" style="height:100; width:100" /></td>
pic}”style=“高度:100;宽度:100”/>
您应该尝试以下方法:
<td> <img src="storage/app/fileToUpload/".{{ $user->pic }} style="height:100; width:100" /></td>
pic}style=“高度:100;宽度:100”/>
将其更改为img src=“storage/app/fileToUpload/”{{{{$user->pic}}您是否应用了php artisan存储:link
?也请检查页面的元数据。是否允许包含内联img src?@Satya我已经应用了,但没有工作你从{{{$user->pic}}中得到了什么值?在你的回答中不应该是pic}为什么要这样做?oyu能解释一下除了坏掉的标记之外,你还改变了什么吗?当前代码段生成的URL将只包含storage/app/fileToUpload/
,而src
属性之外将有一些动态字符串