2017-07-21 105 views
0

每当我将输入作为数组取样时,我会得到以下错误。只有当我提交表单时Laravel数组输入 - htmlentities()期望参数1是字符串,数组给定

enter image description here

的问题。

此我输入数组如何:

enter image description here

+2

'old('type')'是数组,你应该得到它的第一个值,手动填充输入。 – TheFallen

+0

如果只有一个,name =“type []”应该是name =“type”。如果有多个,那么它是一个数组,你应该在提交之后处理每个值。 –

回答

0

似乎要传递的输入作为一个类型的数组。 htmlentities()仅适用于字符串类型。 这

<td><input type="text" name="type[]" value="{{ old('type') }}" class="form-control"></td> 

应该

<td><input type="text" name="type" value="{{ old('type.0') }}" class="form-control"></td> 

的type.0将数组中只返回的第一个项目。

相关问题