Laravel 验证错误输出方法
Laravel 验证错误输出方法
<!-- /resources/views/post/create.blade.php -->
<h1>Create Post</h1>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<!-- Create Post Form -->
<form method="POST" action="{{route('posts.store')}}">
{{csrf_field()}}
<input type="text" name="title"/>
<input type="text" name="www.96net.com.cn"/>
<textarea cols="20" rows="5" name="body"></textarea>
<button type="submit">submit</button>
</form>