当使用表示多维数组的输入名称时,我在 Laravel 4.2 中遇到了 Form 外观的问题。除非在 Input::old() 中设置了值(因为验证失败等),否则表单将正确加载、显示和发布数据。
这是一个显示问题的简单示例:
路线.php:
Route::get('input-test', function() {
return View::make('input_test.index');
});
Route::post('input-test', function() {
return Redirect::back()->withInput(Input::all());
});
input_test/index.blade.php:
<!doctype html>
<html>
<head>
<title>Input Array Test</title>
</head>
<body>
{{ Form::open(array('url' => 'input-test')) }}
{{ Form::label('customer[some_customer_field][]', 'Customer Field:') }} <br>
{{ Form::text('customer[some_customer_field][]', null) }}
{{ Form::submit('Submit') }}
{{ Form::close() }}
</body>
</html>
提交此表单将引发错误:
htmlentities() expects parameter 1 to be string, array given
有没有办法让这些类型的名称的输入在回发中起作用?