使用illuminate/html 提示: Call to undefined method Illuminate\Foundation\Application::bindShared()

报错内容

 

[Symfony\Component\Debug\Exception\FatalErrorException]

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

 

查了一下,大概是说Laravel5.1后,illuminate/html 已经被废弃了,可以使用 laravelcollective/html 来替换

 

首先删除 illuminate/html在config/app.php 中添加的配置

 

'Illuminate\Html\HtmlServiceProvider'

'Form'      => 'Illuminate\Html\FormFacade',
'HTML'      => 'Illuminate\Html\HtmlFacade

 

然后执行以下命令移除illuminate/html

 

composer remove illuminate/html

composer update

 

 

成功后,使用新的Package来替换,执行以下命令

 

composer require laravelcollective/html

 

同样,将以下配置项添加到 illuminate/html在config/app.php 中

 

# providers
Collective\Html\HtmlServiceProvider::class,

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

 

OK。

 

posted @ 2017-10-24 13:29  jialongfei  阅读(1571)  评论(0编辑  收藏  举报