【发布时间】:2018-06-28 10:42:06
【问题描述】:
用户上传多张图片并以数组形式存储。如何在 laravel 刀片文件中显示这些图像?
当我尝试时,我得到了这个错误。
htmlspecialchars() expects parameter 1 to be string, array given (View: C:\Users\user\laravel2\newfyp\resources\views\postqs\show.blade.php)
显示刀片:
<img src="/image/{{ $postqs['image'] }}"
style="width:150px; height:150px;"> </td>
型号:
protected $casts = [
'image'=>'array', ];
protected $fillable = ['image'];
创建刀片
<div class="form-group">
<label class="control-label col-sm-2" >image test:
</label>
<form action="upload" id="upload" enctype="multipart/form-data">
<input type="file" name="image[]" id="image" multiple><br />
</form>
<div id="message"></div>
【问题讨论】:
-
你能显示转储的数组代码吗?我的意思是转储数组并在此处显示结果
-
$postqs['image']是数组而不是字符串
标签: php arrays database image laravel