为什么从 Laravel 5 开始不推荐使用 Form 和 HTML 助手?我知道我可以使用诸如 laravelcollective/html
包之类的东西.但我只是想知道为什么 Laravel 停止使用/下放助手.
Why are the Form and HTML helpers deprecated since Laravel 5? I know I could use something like laravelcollective/html
packages. But I was just wondering why Laravel stopped using/devolving the helpers.
答案很简单.
Taylor Otwell 决定从核心组件中删除 Form 和 Html,因为它应该由社区通过诸如 之类的包来维护https://github.com/LaravelCollective/html.几乎没有其他组件被移除以保持框架纤薄.不是每个人都使用 Form 和 HTML ,我个人更喜欢纯 HTML .
Taylor Otwell decided to remove Form and Html from core components because it's something that should be maintained by the community through packages like https://github.com/LaravelCollective/html. Few other components were removed to keep the framework slim. Not everyone uses Form and HTML , I personally prefer pure HTML.
我的意见
我对此的一个看法是性能问题,如果您检查 Form 和 HTML 类,您将看到表单实际是如何生成的,这涉及使用 foreach
和其他脚本进行循环,只是为了生成简单的当您在刀片中使用纯 HTML 时,这种形式根本不会发生.
One of my opinions on this is the issue of performance, If you check Form and HTML classes you will see how forms are actually generated, which involves looping with foreach
and other script just to generate simple form which simply doesn't happen when you use your plain HTML in your blade.
Laravel 表单 &HTML 组件在完全自定义方面也有局限性,但是当您在 Blade 中使用纯 HTML 时,您可以随意自定义表单,任何前端开发人员都可以在不学习 Laravel 或 Blade 的情况下理解它.
Laravel Form & HTML components also have limitations in terms of full customization but when you use plain HTML in your blade you can freely customize the form in anyway you like and any front-end developer can understand it without learning Laravel or Blade.
我实际上认为 Laravel Form &HTML 适合懒惰的开发人员,我认为 :)
I actually think Laravel Form & HTML are for lazy developers, my opinion :)
你可以不用 Form &Html 构建器完全或者你可以使用可用的包
You can do without Form & Html builders completely or you can use available packages
这篇关于为什么在 Laravel 5.x 中不推荐使用 Form 和 HTML 助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!