Laravel踩坑笔记——illuminate/html被抛弃

原由php

在使用以下代码的时候发生报错html

{!! Form::open() !!}

  错误信息laravel

[Symfony\Component\Debug\Exception\FatalErrorException]

Call to undefined method Illuminate\Foundation\Application::bindShared()

缘由app

在Stack Overflow找到相关问题(Call to undefined method Illuminate\Foundation\Application::bindShared()composer

由你们的回答和官方文档(Upgrade Guide)中能够知道,bindShared已经被抛弃ide

 

The actual issue is that L 5.1 has depreciated bindShared and illuminate still uses it. From the L5 upgrade page: The service container's 
bindShared method has been deprecated in favor of the singleton method. --panthro

  

解决ui

打开config/app.phpspa

移除如下句orm

providers中的
'Illuminate\Html\HtmlServiceProvider'

aliases中的
'Form'      => 'Illuminate\Html\FormFacade',
'HTML'      => 'Illuminate\Html\HtmlFacade

移除illuminate/htmlhtm

composer remove illuminate/html
composer update

从官方文档咱们能够看到,代替的包为laravelcollective/html

 

因此

安装laravelcollective/html

composer require laravelcollective/html

回到config/app.php

 加入以下语句

providers中的
Collective\Html\HtmlServiceProvider::class,

aliases中的
'Form'=>Collective\Html\FormFacade::class,
'Html'=>Collective\Html\HtmlFacade::class,

  问题解决

另外

1.本文写做时使用Laravel版本5.4,PHP版本5.6

2.附上Laravel关于Forms & HTML的文档(基于5.4)——laravelcollective/html

相关文章
相关标签/搜索