Laravel数组输入 - htmlentities()要求参数1为字符串,给定数组

时间:2017-07-21 07:44:12

标签: php arrays laravel-5.2

每当我将具有输入的表单作为数组汇总时,我都会收到以下错误。

enter image description here

只有在我提交表单时才会出现问题。

我的输入数组如何:

enter image description here

1 个答案:

答案 0 :(得分: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只返回数组中的第一项。