問題描述
為什么從 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模板網!