这个问题在我升级Laravel之后就出现,准确的不能说是5.4,而是5.1之后就会出现问题。

如果按照之前使用 {!! Form::open() !!} 这样子来使用的话,虽然composer require illuminate/html成功了,并且app的配置也没问题,但是就会出现 Call to undefined method IlluminateFoundationApplication::bindShared() 的错误。

我最初查和看到产生的原因是在stackoverflow:

问题的链接:http://stackoverflow.com/questions/31250211/call-to-undefined-method-illuminate-foundation-applicationbindshared

其中采纳的答案如下:

Okay based on your comment I see your issue (I should have noticed it sooner as you do mention the HTML component in your question.

The illuminate/html component is no longer part of Laravel proper, and hasn't yet been updated to conform to 5.1 standards. In fact, I'm pretty sure it is now officially abandoned by Taylor.

However, you can replace the illuminate/html requirement with laravelcollective/html - that's the official community takeover of illuminate/html and should be a drop-in replacement.

No having to mess with stuff in vendor!

其实就是5.1之后bindShare已经不再兼容了,所以现在都推荐使用laravelcollective/html

$ composer require laravelcollective/html

当然使用了laravelcollective之后,app的配置也是需要进行变化的,这里给出官方网站的安装以及配置和使用的链接,非常详细。

https://laravelcollective.com/docs/5.2/html#installation

配置app的时候,就是将以前

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

IlluminateHtml中的内容改成CollectiveHtml就可以,其他的使用什么的没什么变化。

除了上面两个需要修改的,provider中也应该修改,我上面图省事没写,后面发现有歧义:

'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

postbird

为此,我也去详细的了解了一下升级的一些注意事项。关于升级的内容可以看这个链接:

https://laravel-china.org/docs/5.4/upgrade