• <tfoot id='JnpFi'></tfoot>
  • <small id='JnpFi'></small><noframes id='JnpFi'>

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

      • <bdo id='JnpFi'></bdo><ul id='JnpFi'></ul>

        <legend id='JnpFi'><style id='JnpFi'><dir id='JnpFi'><q id='JnpFi'></q></dir></style></legend>
      1. 带有 PUT 方法的 Laravel 表单 html 用于 PUT 路由

        时间:2023-10-31

            • <bdo id='fYy27'></bdo><ul id='fYy27'></ul>

                <tbody id='fYy27'></tbody>
            • <small id='fYy27'></small><noframes id='fYy27'>

                  <tfoot id='fYy27'></tfoot>

                  <i id='fYy27'><tr id='fYy27'><dt id='fYy27'><q id='fYy27'><span id='fYy27'><b id='fYy27'><form id='fYy27'><ins id='fYy27'></ins><ul id='fYy27'></ul><sub id='fYy27'></sub></form><legend id='fYy27'></legend><bdo id='fYy27'><pre id='fYy27'><center id='fYy27'></center></pre></bdo></b><th id='fYy27'></th></span></q></dt></tr></i><div id='fYy27'><tfoot id='fYy27'></tfoot><dl id='fYy27'><fieldset id='fYy27'></fieldset></dl></div>
                  <legend id='fYy27'><style id='fYy27'><dir id='fYy27'><q id='fYy27'></q></dir></style></legend>
                1. 本文介绍了带有 PUT 方法的 Laravel 表单 html 用于 PUT 路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的路线中有这个:

                  +--------+---------------------------+--------------+---------------------------                                                                                                                ---------+----------------+---------------+
                  | Domain | URI                       | Name         | Action                                                                                                                                             | Before Filters | After Filters |
                  +--------+---------------------------+--------------+---------------------------                                                                                                                ---------+----------------+---------------+
                  |        | GET|HEAD /                |              | postcontroller                                                                                                                                     | auth           |               |
                  |        | GET|HEAD login            |              | homecontroller@dologin                                                                                                                             |                |               |
                  |        | POST login                |              | homecontroller@dologin                                                                                                                             |                |               |
                  |        | GET|HEAD logout           |              | homecontroller@dologout                                                                                                                            |                |               |
                  |        | GET|HEAD post             | post.index   | postcontroller@index                                                                                                                               |                |               |
                  |        | GET|HEAD post/create      | post.create  | postcontroller@create                                                                                                                              |                |               |
                  |        | POST post                 | post.store   | postcontroller@store                                                                                                                               |                |               |
                  |        | GET|HEAD post/{post}      | post.show    | postcontroller@show                                                                                                                                |                |               |
                  |        | GET|HEAD post/{post}/edit | post.edit    | postcontroller@edit                                                                                                                                |                |               |
                  |        | PUT post/{post}           | post.update  | postcontroller@update                                                                                                                              |                |               |
                  |        | PATCH post/{post}         |              | postcontroller@update                                                                                                                              |                |               |
                  |        | DELETE post/{post}        | post.destroy | postcontroller@destroy 
                  

                  现在,我想制作一个将使用 PUT 方法的表单 html.这是我的代码:

                  Now, i want to make a form html that will use PUT method. Here it is my codes:

                  <form class="col-md-12" action="<?php echo URL::to('/');?>/post/<?=$post->postID?>" method="put">
                      <div class="form-group">
                          <textarea type="text" class="form-control input-lg" placeholder="Text Here" name="post"><?=$post->post?></textarea>
                      </div>
                      <div class="form-group">
                          <button class="btn btn-primary btn-lg btn-block" type="submit" value="Edit">Edit</button>
                      </div>
                  </form>     
                  

                  但我无法将表单提交到 post.edit.

                  But i doesn't work to submit the form into post.edit.

                  我已经用谷歌搜索了,我得到了我必须使用的解决方案

                  I Have googled and i got solution that i must use

                  {{form:...etc
                  

                  但是,我希望表单仍然可以通过 CSS 样式来完成.大佬们有解决办法吗?谢谢你

                  But, i want the form still can done by CSS styling. Is there any solution guys? Thank You

                  推荐答案

                  您可以添加 css 类,以及刀片模板所需的任何类型的属性,试试这个:

                  You CAN add css clases, and any type of attributes you need to blade template, try this:

                  {{ Form::open(array('url' => '/', 'method' => 'PUT', 'class'=>'col-md-12')) }}
                  .... wathever code here
                  {{ Form::close() }}
                  

                  如果您不想采用刀片方式,您可以添加隐藏输入.这是 Laravel 的形式,无论如何:

                  If you dont want to go the blade way you can add a hidden input. This is the form Laravel does, any way:

                  注意:由于 HTML 表单仅支持 POST 和 GET、PUT 和 DELETE方法将通过自动添加 _method 隐藏字段来进行欺骗到你的表格.(Laravel 文档)

                  Note: Since HTML forms only support POST and GET, PUT and DELETE methods will be spoofed by automatically adding a _method hidden field to your form. (Laravel docs)

                  <form class="col-md-12" action="<?php echo URL::to('/');?>/post/<?=$post->postID?>" method="POST">
                  
                      <!-- Rendered blade HTML form use this hidden. Dont forget to put the form method to POST -->
                  
                      <input name="_method" type="hidden" value="PUT">
                  
                      <div class="form-group">
                          <textarea type="text" class="form-control input-lg" placeholder="Text Here" name="post"><?=$post->post?></textarea>
                      </div>
                  
                      <div class="form-group">
                          <button class="btn btn-primary btn-lg btn-block" type="submit" value="Edit">Edit</button>
                      </div>
                  </form>
                  

                  这篇关于带有 PUT 方法的 Laravel 表单 html 用于 PUT 路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Laravel 5路线未定义,而它是? 下一篇:如何在路由 INI 文件中为 Zend 框架中的子域编写路由链?

                  相关文章

                2. <tfoot id='Z6HxA'></tfoot>

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

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

                      • <bdo id='Z6HxA'></bdo><ul id='Z6HxA'></ul>