不存在的类:Mongo_db


Non-existent class: Mongo_db

我对ion_auth有问题。我转换了所有必需的文件适合Mongodb。我的配置莱尔斯mongo_db.php

<?
   $config['mongo_host'] = 'localhost';
   $config['mongo_port'] = 27017;
   $config['mongo_db'] = 'tls_saas';
   $config['mongo_user'] = 'root';
   $config['mongo_pass'] = 'root';
   $config['mongo_persist'] = TRUE;
   $config['mongo_persist_key'] = 'ci_mongo_persist';
   ?>

ion_auth.php

$config['use_mongodb'] = TRUE;
/*
| -------------------------------------------------------------------------
| MongoDB Collection.
| -------------------------------------------------------------------------
| Setup the mongodb docs using the following command:
| $ mongorestore sql/mongo
|
*/
$mongorestore                    = 'sql/mongo';
$config['collections']['users']          = 'users';
$config['collections']['groups']         = 'groups';
$config['collections']['login_attempts'] = 'login_attempts';

但我仍然收到错误

不存在的类:Mongo_db

是他们要做出更多的改变. ion_auth现在与MongoDB合作??

解决了!!问题出在 LOADER中的代码点火器类声明.php .如果收到此错误,请添加以下行。代码点火器不允许在以下情况下加载页面

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

在文件开头找不到,则代码点火器跳过该文件。

除了配置文件之外,您还需要添加和加载库。

https://github.com/huglester/MongoDB-CodeIgniter-Driver/blob/master/libraries/Mongo_db.php

https://github.com/huglester/MongoDB-CodeIgniter-Driver/blob/master/README

该错误表示您尚未添加或加载库。

位于

系统/库/Mongo_db.php中的"Mongo_db"库,请编辑此文件并将类名从"Mongo_db"修改为"CI_Mongo_db",这将解决此问题。