在html页面中显示错误信息

  1. 使用errors->any()判断是否存在错误
  2. 若存在错误,则循环$errors->all()中的全部错误信息
    1. @if($errors->any())
    2. <div class="alert alert-danger">
    3. <ul>
    4. @foreach ($errors->all() as $error)
    5. <li>{{ $error }}</li>
    6. @endforeach
    7. </ul>
    8. </div>
    9. @endif