Laravel 和 HTML 表单生成器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29227897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel and HTML Form Builder
提问by JoshuaDavid
I like the Form Builder. Go Laravel.
我喜欢表单生成器。去 Laravel。
What's the difference between the Illuminate versionand the Laravel Collective version, and which should we use? Is the Illuminate version now defunct?
Illuminate 版本和Laravel Collective 版本有什么区别,我们应该使用哪个?Illuminate 版本现在已经不复存在了吗?
回答by Needpoule
You have an explanation here : http://laravel.com/docs/5.0/upgrade#upgrade-5.0under Form & HTML Helpers
你在这里有一个解释:http: //laravel.com/docs/5.0/upgrade#upgrade-5.0在Form & HTML Helpers 下
Basically, the Illuminate versions of the Form helper and HTML helper are deprecated in the current version of Laravel and have been removed from the framework's core. They are now maintained by the Laravel Collective.
基本上,Form helper 和 HTML helper 的 Illuminate 版本在当前版本的 Laravel 中已被弃用,并已从框架的核心中删除。它们现在由 Laravel 集体维护。
So if you working with Laravel 5, you should use the Laravel Collective version, you can find it here: laravel Collective: Forms & HTML
所以如果你使用 Laravel 5,你应该使用 Laravel Collective 版本,你可以在这里找到它:laravel Collective: Forms & HTML
回答by nclsvh
In Laravel 5 it is not standard anymore, but you can add it quickly in the composer file if you prefer to work with forms like you did in Laravel 4.
在 Laravel 5 中它不再是标准的,但是如果你喜欢像在 Laravel 4 中那样使用表单,你可以快速地将它添加到 composer 文件中。
Just add this line in the composer.json, under the requiresection:
只需在 composer.json 的require部分下添加这一行:
"illuminate/html": "5.*"
After this step you first need to run the composer updatecommand and you should be good to add the rest.
在这一步之后,你首先需要运行composer update命令,你应该可以添加其余的。
Then you need to add the service providers in config/app.php under providerssection like this:
然后你需要在 config/app.php 中的providers部分下添加服务提供者,如下所示:
Illuminate\Html\HtmlServiceProvider
And as the last part enter these two lines in the config/app.php under aliasessection:
作为最后一部分,在别名部分下的 config/app.php 中输入这两行:
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade'