Laravel-调用未定义的方法Illuminate \ Foundation \ Application :: share() [英] Laravel - Call to undefined method Illuminate\Foundation\Application::share()
问题描述
我正在从Laravel 5.3升级到Laravel 5.4.问题是,当我运行 composer update
以及涉及 php artisan优化
部分时,出现错误:
I am upgrading from Laravel 5.3 to Laravel 5.4. Problem is that when I run composer update
and when it comes to php artisan optimize
part, I get an error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::share()
我在此处已在StackOverflow上阅读了几个问题,答案是将这种共享方法替换为单例.但是我在哪里可以找到这个 share()
?
I've read a couple of questions here on StackOverflow and the answer is to replace this share method with singleton. But where can I find this share()
?
编辑
我的composer.json文件:
My composer.json file:
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"sngrl/sphinxsearch": "dev-master",
"laravelcollective/html": "5.4.*",
"aws/aws-sdk-php-laravel": "~3.0",
"league/flysystem-aws-s3-v3": "^1.0",
"mcamara/laravel-localization": "1.2.*",
"league/csv": "^8.2",
"mikehaertl/phpwkhtmltopdf": "^2.2",
"barryvdh/laravel-snappy": "^0.3.3",
"wemersonjanuario/wkhtmltopdf-windows": "dev-master",
"nesbot/carbon": "^1.22",
"uxweb/sweet-alert": "^1.4",
"laracasts/flash": "^2.0",
"guzzlehttp/guzzle": "^6.2",
"illuminate/support": "5.4.*",
"laravel/scout": "^3.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
推荐答案
Project Share()方法文件为以下路径:
Project Share() method file is the Following Path:
您的项目>>供应商>> laravel >>框架>> src >>照亮>>容器>> Container.php
Your Project >> Vendor >> laravel >> framework >> src >> Illuminate >> Container >> Container.php
注释您的share()方法代码并放在下面的代码中.
Comment your share() method code and put below code.
public function singleton($abstract, $concrete = null)
{
$this->bind($abstract, $concrete, true);
}
这篇关于Laravel-调用未定义的方法Illuminate \ Foundation \ Application :: share()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!