zoukankan      html  css  js  c++  java
  • Laravel踩坑笔记——illuminate/html被抛弃

    起因

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

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

      错误信息

    [SymfonyComponentDebugExceptionFatalErrorException]
    
    Call to undefined method IlluminateFoundationApplication::bindShared()
    

    原因

    在Stack Overflow找到相关问题(Call to undefined method IlluminateFoundationApplication::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中的
    'IlluminateHtmlHtmlServiceProvider'
    
    aliases中的
    'Form'      => 'IlluminateHtmlFormFacade',
    'HTML'      => 'IlluminateHtmlHtmlFacade
    

    移除illuminate/html

    composer remove illuminate/html
    composer update
    

    从官方文档我们可以看到,代替的包为laravelcollective/html

    所以

    安装laravelcollective/html

    composer require laravelcollective/html
    

    回到config/app.php

     加入如下语句

    providers中的
    CollectiveHtmlHtmlServiceProvider::class,
    
    aliases中的
    'Form'=>CollectiveHtmlFormFacade::class,
    'Html'=>CollectiveHtmlHtmlFacade::class,
    

      问题解决

    另外

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

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

  • 相关阅读:
    NET 事件与委托
    NET高级 REF OUT
    缓冲池
    NET高级 EQUAL相等
    装箱拆箱
    CTS、CLS、CLR
    结构体及引用类型
    NET高级-深拷贝浅拷贝
    密闭类 静态 类及扩展方法
    NET高级-索引器
  • 原文地址:https://www.cnblogs.com/joyceX/p/7060145.html
Copyright © 2011-2022 走看看