版权声明:http://www.itchuan.net https://blog.csdn.net/sinat_37390744/article/details/88550988
1、安装拓展
composer require laravelcollective/html
2、config\app.php中providers数组中
'providers'=>[
//...
Collective\Html\HtmlServiceProvider::class,
//...
],
3、config\app.php中aliases数组中
'aliases'=>[
// ...
'Form'=>Collective\Html\FormFacade::class,
'Html'=>Collective\Html\HtmlFacade::class,
// ...
],
4、view使用
{{\Form::open(['url'=>'/'])}}
<div class="input-group">
{{\Form::text('url','',['class'=>'form-control input-lg','placeholder'=>'请输入您的网址'])}}
<span class="input-group-btn">
{{\Form::submit('缩短','',['class'=>'btn btn-success btn-lg'])}}
</span>
</div><!-- /input-group -->
{{\Form::close()}}
注意:
如果您事先使用了Illuminate\Html,如果版本5.1.x以上,则需要先卸载
1、去除providers、aliases数组中配置
//Providers
//'Illuminate\Html\HtmlServiceProvider'
//aliases
//'Form' => 'Illuminate\Html\FormFacade',
//'HTML' => 'Illuminate\Html\HtmlFacade
2、执行
composer remove illuminate/html
composer update