2017-07-21 100 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將數組中只返回的第一個項目。

相關問題