仔细阅读过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>

 

相关文章:

  • 2022-12-23
  • 2021-06-27
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-21
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-07-10
相关资源
相似解决方案