laravel 找不到类“Jenssegers\Mongodb\MongodbServiceProvider”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29263673/
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 11:13:07  来源:igfitidea点击:

Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

phpmongodblaravellaravel-5

提问by George Chumburidze

I want to use https://github.com/jenssegers/laravel-mongodbfor connecting to Mongodb with laravel 5, i have installed MongoDB php driver and then laravel-mongodb with command composer require jenssegers/mongodb, then added service provider in app/config/app.php:

我想使用https://github.com/jenssegers/laravel-mongodb通过 laravel 5 连接到 Mongodb,我已经安装了 MongoDB php 驱动程序,然后使用 command 安装了 laravel-mongodb composer require jenssegers/mongodb,然后在 app/config/app 中添加了服务提供程序。 php:

'Jenssegers\Mongodb\MongodbServiceProvider',

and refreshed my website, unfortunately i got error ->

并刷新了我的网站,不幸的是我遇到了错误 ->

FatalErrorException in compiled.php line 6466:
Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

how can i fix it?

我该如何解决?

采纳答案by disf.asia

run composer dump-autoloador php artisan optimize

运行composer dump-autoloadphp artisan optimize

回答by Gonzalo Quispe Fernandez

I didn't have the archive: myproject/vendor/jenssegers.

我没有存档: myproject/vendor/jenssegers。

I installed this archive by command:

我通过命令安装了这个存档:

$ composer require jenssegers/mongodb

回答by Ashish

Delete Following Files and Use This Step :

删除以下文件并使用此步骤:

composer.lock

bootstrap/cache/config.php

composer.lock

引导程序/缓存/config.php

if exist

如果存在

bootstrap/cache/services.php

引导程序/缓存/services.php

then Run this command :

然后运行此命令:

composer install

php artisan config:cache

作曲家安装

php工匠配置:缓存