【发布时间】:2017-08-05 17:45:23
【问题描述】:
我的看法是
<input type="text" name="color[]" value="{{ old('color') }}" placeholder="Enter Color">
<input type="text" name="price[]" value="{{ old('price') }}" placeholder="Enter Price">
并且由于价格和颜色是一个数组,因此在验证后尝试发回数组的值会出错。
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return redirect('rate/create')
->withErrors($validator)
->withInput();
这里 withInput() 报错。错误如下:
htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/.../www/abc/resources/views/abc/create.blade.php).
如何在验证后将该错误发送给查看。我也需要验证这个数组。谢谢你
【问题讨论】:
标签: php arrays laravel validation laravel-5.3