小编ASW*_* TK的帖子

codeigniter 3.x中的MongoDB\Driver\Exception\InvalidArgumentException

将CI 2.x中的项目迁移到3.x后,显示以下错误,其中我使用了mongo db,这在codeigniter版本2中工作正常,

消息:无法解析MongoDB URI:'mongodb://'.URI中的主机字符串无效.

Db配置

// Generally will be localhost if you're querying from the machine that Mongo is installed on
$config['mongo_host'] = "localhost";
//$config['mongo_host'] = "xxxxxxxxx.compute.amazonaws.com";

// Generally will be 27017 unless you've configured Mongo otherwise
$config['mongo_port'] = 27017;

// The database you want to work from (required)
$config['mongo_db'] = "test_p1";

// Leave blank if Mongo is not running in auth mode
$config['mongo_user'] = "";
$config['mongo_pass'] = "";

// Persistant connections
$config['mongo_persist'] = TRUE;
$config['mongo_persist_key'] = 'ci_mongo_persist';

// …
Run Code Online (Sandbox Code Playgroud)

php mongodb codeigniter-3

5
推荐指数
1
解决办法
432
查看次数

标签 统计

codeigniter-3 ×1

mongodb ×1

php ×1