学习laravel遇到的一些错误
Call to undefined method Illuminate\Foundation\Application::bindShared()
错误代码
Call to undefined method Illuminate\Foundation\Application::bindShared()
原因
The Form and HTML helpers have been deprecated in Laravel 5.0; form模块依赖于laravel 5.0框架,所以在默认的5.2框架里调用还是会有问题,现时5.2还没有作出修复,所以需要重新安装。
解决
1.在composer.json文件的require里添加一行”laravelcollective/html”: “~5.0″完成版
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"illuminate/html": "^5.0",
"barryvdh/laravel-ide-helper": "v2.1.2",
"laravelcollective/html": "~5.0"
},
composer.json位置在laravel目录根层
2.然后运行命令
composer update
主要是通过composer来重新管理laravel框架的文件
3.更新成功后,修改config/app.php文件增加配置:
#增加providers数组项
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
#增加alias数组项
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],