1. <legend id='TDJ7Q'><style id='TDJ7Q'><dir id='TDJ7Q'><q id='TDJ7Q'></q></dir></style></legend>

        <i id='TDJ7Q'><tr id='TDJ7Q'><dt id='TDJ7Q'><q id='TDJ7Q'><span id='TDJ7Q'><b id='TDJ7Q'><form id='TDJ7Q'><ins id='TDJ7Q'></ins><ul id='TDJ7Q'></ul><sub id='TDJ7Q'></sub></form><legend id='TDJ7Q'></legend><bdo id='TDJ7Q'><pre id='TDJ7Q'><center id='TDJ7Q'></center></pre></bdo></b><th id='TDJ7Q'></th></span></q></dt></tr></i><div id='TDJ7Q'><tfoot id='TDJ7Q'></tfoot><dl id='TDJ7Q'><fieldset id='TDJ7Q'></fieldset></dl></div>

        <small id='TDJ7Q'></small><noframes id='TDJ7Q'>

          <bdo id='TDJ7Q'></bdo><ul id='TDJ7Q'></ul>
        <tfoot id='TDJ7Q'></tfoot>
      2. Laravel 表单方法 VS 传统编码

        Laravel Form methods VS traditional coding(Laravel 表单方法 VS 传统编码)

          <bdo id='1UlNA'></bdo><ul id='1UlNA'></ul>

              <tbody id='1UlNA'></tbody>
          1. <i id='1UlNA'><tr id='1UlNA'><dt id='1UlNA'><q id='1UlNA'><span id='1UlNA'><b id='1UlNA'><form id='1UlNA'><ins id='1UlNA'></ins><ul id='1UlNA'></ul><sub id='1UlNA'></sub></form><legend id='1UlNA'></legend><bdo id='1UlNA'><pre id='1UlNA'><center id='1UlNA'></center></pre></bdo></b><th id='1UlNA'></th></span></q></dt></tr></i><div id='1UlNA'><tfoot id='1UlNA'></tfoot><dl id='1UlNA'><fieldset id='1UlNA'></fieldset></dl></div>
            <tfoot id='1UlNA'></tfoot>
          2. <small id='1UlNA'></small><noframes id='1UlNA'>

            <legend id='1UlNA'><style id='1UlNA'><dir id='1UlNA'><q id='1UlNA'></q></dir></style></legend>

                  本文介绍了Laravel 表单方法 VS 传统编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在学习 Laravel,发现它非常有用且有趣.

                  I am currently learning Laravel and finding it really useful and interesting.

                  目前我正在制作一个简单的在线申请表.

                  At the moment I am making a simple online application form.

                  使用 Laravel 语法做事的最大优势是什么:

                  What are the biggest advantages to doing things using the Laravel syntax like:

                  {{ Form::open(array('url' => 'foo/bar')) }}
                  

                  相对于简单的:

                  <form action="foo/bar">
                  

                  或者:

                  echo Form::text('username');
                  

                  代替:

                  <input type="text" name="username" />
                  

                  Laravel的方式一定更好,我只是想知道为什么?

                  The Laravel way must be better, I just wish to know why exactly?

                  推荐答案

                  使用内置的 HTML 助手有很多好处:

                  Using built-in HTML helpers have many benefits:

                  1. 使用 Form::open 添加 CSRF 保护输入隐藏(默认)

                  1. Using Form::open you add CSRF protection input hidden (by default)

                  使用表单元素(inputs/textarea 等)和 withInput 方法进行重定向,让您可以轻松地用相同的数据填写表单,几乎无需编码

                  Using form elements (inputs/textarea etc.) and withInput method for Redirection allows you to easily fill in the form with the same data with almost no coding

                  如果你使用 Redirect::route('form'->withInput(); 并且有输入text {{Form::text('username')}} 它将自动将输入的值设置为旧数据 - 您无需自己编写代码检查它

                  If you use Redirect::route('form'->withInput(); and have input text {{Form::text('username')}} it will automatically set input's value the old data - you don't need to code it yourself checking it

                  此外,如果您想将字段与标签匹配起来会容易得多:

                  Also if you want to match fields with labels its much easier:

                  {{ Form::label('username', 'Enter username') }}
                  {{ Form::text('username') }}
                  

                  它将生成以下代码:

                  <label for="username">Enter username</label>
                  <input name="username" type="text" id="username">
                  

                  如您所见,id 将自动创建

                  so as you see id will be created automatically

                  可能还有更多.然而,主要的缺点是您需要学习并且它不便携,以防您想将您的网站移动到其他框架,但每个解决方案都有优点和缺点.

                  Probably there are some more. However the main disadvantage is that you need to learn and it's not portable in case you want to move your site to other Framework but each solution has pros and cons.

                  这篇关于Laravel 表单方法 VS 传统编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Laravel 4 - Connect to other database(Laravel 4 - 连接到其他数据库)
                  Call external API function from controller, LARAVEL 4(从控制器调用外部 API 函数,LARAVEL 4)
                  Empty string instead of null values Eloquent(空字符串而不是空值 Eloquent)
                  quot;laravel.logquot; could not be opened: failed to open stream(“laravel.log无法打开:无法打开流)
                  Displaying the Error Messages in Laravel after being Redirected from controller(从控制器重定向后在 Laravel 中显示错误消息)
                  Laravel Creating Dynamic Routes to controllers from Mysql database(Laravel 从 Mysql 数据库创建到控制器的动态路由)
                    <tbody id='OFndH'></tbody>

                1. <tfoot id='OFndH'></tfoot><legend id='OFndH'><style id='OFndH'><dir id='OFndH'><q id='OFndH'></q></dir></style></legend>
                  1. <i id='OFndH'><tr id='OFndH'><dt id='OFndH'><q id='OFndH'><span id='OFndH'><b id='OFndH'><form id='OFndH'><ins id='OFndH'></ins><ul id='OFndH'></ul><sub id='OFndH'></sub></form><legend id='OFndH'></legend><bdo id='OFndH'><pre id='OFndH'><center id='OFndH'></center></pre></bdo></b><th id='OFndH'></th></span></q></dt></tr></i><div id='OFndH'><tfoot id='OFndH'></tfoot><dl id='OFndH'><fieldset id='OFndH'></fieldset></dl></div>
                    • <bdo id='OFndH'></bdo><ul id='OFndH'></ul>

                        • <small id='OFndH'></small><noframes id='OFndH'>