Laravel 表单 html 与 PUT 方法的 PUT 路由
问题描述
我的路线中有这个:
现在,我想制作一个使用 PUT 方法的表单 html.这是我的代码:
但我无法将表单提交到 post.edit.
我用谷歌搜索过,我得到了必须使用的解决方案
但是,我希望表单仍然可以通过 CSS 样式来完成.各位大侠有解决办法吗?谢谢
您可以添加 css 类,以及刀片模板所需的任何类型的属性,试试这个:
如果你不想走刀片的方式,你可以添加一个隐藏的输入.无论如何,这就是 Laravel 的形式:
<块引用>注意:由于 HTML 表单只支持 POST 和 GET、PUT 和 DELETE方法将通过自动添加 _method 隐藏字段来欺骗到你的表格.(Laravel 文档)
<div class="form-group"><button class="btn btn-primary btn-lg btn-block";类型=提交"值=编辑">编辑"
</表单>
I Have this in my routes :
Now, i want to make a form html that will use PUT method. Here it is my codes:
But i doesn't work to submit the form into post.edit.
I Have googled and i got solution that i must use
But, i want the form still can done by CSS styling. Is there any solution guys? Thank You
You CAN add css clases, and any type of attributes you need to blade template, try this:
If you dont want to go the blade way you can add a hidden input. This is the form Laravel does, any way:
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)
这篇关于Laravel 表单 html 与 PUT 方法的 PUT 路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!