首页 > Web开发 > 详细

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

时间:2017-06-21 16:41:55      阅读:1377      评论:0      收藏:0      [点我收藏+]

起因

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

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

  错误信息

[Symfony\Component\Debug\Exception\FatalErrorException]

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

原因

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

由大家的回答和官方文档(Upgrade Guide)中可以知道,bindShared已经被抛弃

 

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

  

解决

打开config/app.php

移除以下句

providers中的
‘Illuminate\Html\HtmlServiceProvider‘

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

移除illuminate/html

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

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

原文:http://www.cnblogs.com/joyceX/p/7060145.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!