Laravel 5.1.11 致命错误:未捕获异常“ReflectionException”,消息为“类日志不存在”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32376654/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:17:46  来源:igfitidea点击:

Laravel 5.1.11 Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist'

phplaravellaravel-5.1illuminate-container

提问by leoalmar

After doing composer updatemy project starts to show this error in everywhere in my production environment. But in local is working perfectly.

完成后,composer update我的项目开始在我的生产环境中的任何地方显示此错误。但在本地运行完美。

Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in 
.../src/Illuminate/Container/Container.php:736 Stack trace: #0 
.../src/Illuminate/Container/Container.php(736): ReflectionClass->__construct('log') #1 
.../src/Illuminate/Container/Container.php(626): Illuminate\Container\Container->build('log', Array) #2 
.../src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array) #3 
.../src/Illuminate/Container/Container.php(837): Illuminate\Foundation\Application->make('Psr\Log\LoggerI...') #4 
.../src/Illuminate/Container/Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 
.../src/Illuminate/Container/Container.php(771): Illuminate\Cont in 
.../src/Illuminate/Container/Container.php on line 736

My local environment is OSX 10.10.5 and my production environment is Linux. I made composer updateagain but don't fix the error.

我的本地环境是 OSX 10.10.5,我的生产环境是 Linux。我composer update又做了一次,但没有修复错误。

My composer.json is look like this:

我的 composer.json 是这样的:

...
"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",
    "folklore/image": "0.2.*",
    "illuminate/html": "5.*",
    "cartalyst/sentry": "dev-feature/laravel-5"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1",
    "laracasts/generators": "~1.1",
    "php-console/php-console": "~3.0",
    "php-console/laravel-service-provider": "~5.0"
}, 
...

回答by leoalmar

Thanks guys!

谢谢你们!

I found the problem.

我发现了问题。

I removedthe packages of my composer.json and works.

删除了我的 composer.json 的包并开始工作。

"php-console/php-console": "~3.0",

"php-console/laravel-service-provider": "~5.0"

"php-console/php-console": "~3.0",

"php-console/laravel-service-provider": "~5.0"

I think that the server does not support the packages because is necessary a .batfile for the packages work.

我认为服务器不支持包,因为.bat包工作需要一个文件。

回答by Aditya Giri

Most of the times, this error fixing is very simple. Just run

大多数情况下,此错误修复非常简单。赶紧跑

composer dump-autoload

and without any doubt, your error will be fixed.

毫无疑问,您的错误将得到修复。