Laravel表单传值

仔细阅读过Laravel官方文档的就不用看啦~

整理下之前遇到的关于Laravel表单的一些小问题

 

表单传值无法传过去,因为laravel做了表单的防护

只需要将{{ csrf_field() }}放在表单中即可

<form method="POST" action="{{route('posts.store')}}">
    {{csrf_field()}}
    <input type="text" name="title"/>
    <input type="text" name="author[name]"/>
    <input type="text" name="author[desc]"/>
    <textarea cols="20" rows="5" name="body"></textarea>
    <button type="submit">submit</button>
</form>

 

posted @ 2018-12-03 16:27  。思索  阅读(687)  评论(0编辑  收藏  举报