search

Home  >  Q&A  >  body text

Are there any benefits of using laravel's form and HTML extension packages?

{!! Form::open(['url' => 'foo/bar']) !!}
{!! Form::close() !!}

As shown in the code, why should we use Form::open to generate a form? Is there any advantage over writing the <form> tag directly?

我想大声告诉你我想大声告诉你2835 days ago632

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 16:49:43

    Because he will handle part of the content on your behalf, such as preventing cross-site tokens

    <input name="_token" type="hidden" value="4P37rt36ym3IyCdTJgqE850iBofqxxZChjtBPeJb">

    The previous content was wrong, please correct it:

    laravelcollective/html is a plug-in that helps create html and form forms. Use it to better create form forms, use laravel's writing method to create it, and reduce the need to write html code, but one important part of it is Will assist in creating CSRF (Cross Site Request Forgery, cross-site domain request forgery) verification token

    reply
    0
  • 黄舟

    黄舟2017-05-16 16:49:43

    Automatically add csrf to prevent repeated submissions and make the code more concise

    reply
    0
  • Cancelreply