Laravel.表单验证错误如果太多就会消失


Laravel. Form validation errors disappearing if there are too many of them

我在Laravel中遇到了一些非常奇怪的行为。在我的请求中,我有一些这样的验证规则:

'field_1' => 'required',
'field_2' => 'required'

如果我提交这个表单没有这些字段,我看到错误。然而,如果我有超过8个失败的验证规则,那么我根本看不到任何错误!视图中的$errors变量突然为空。请求仍然失败并且不执行控制器代码,但是它返回时没有任何错误。

'field_1' => 'required',
'field_2' => 'required',
'field_3' => 'required',
'field_4' => 'required',
'field_5' => 'required',
'field_6' => 'required',
'field_7' => 'required',
'field_8' => 'required',
// No errors displayed in View, but Request returns me back, like if it has failed

似乎与响应的长度有关。如果错误信息比某些东西长(不确定究竟是什么),那么它们不会出现在视图中的$errors变量中。

这很奇怪。怎么解呢?我需要大量的错误信息…

在我看来:

@if ($errors->has())
    <div class="alert alert-danger">
        @foreach (array_unique( $errors->all() ) as $error)
            {{ $error }}<br>
        @endforeach
    </div>
@endif
@if(Session::has('error'))
    <div class="alert alert-danger">
        {{ Session::get('error') }}
    </div>
@endif
@if(Session::has('success'))
    <div class="alert alert-success">
        {{ Session::get('success') }}
    </div>
@endif
@include('flash::message')

我知道现在回答有点晚了,但我也面临着同样的问题。我刚刚检查了config中的session.php,发现我的驱动程序被设置为cookie。我只是把它改成file,一切似乎都起作用了。