tp5.1 mongodb链接报错

浏览:736 发布日期:2018/05/22 分类:求助交流
框架和composer都是最新的。

我在模型里定义了connectionprotected $connection =  [
        // 数据库类型
        'type'          => '\think\mongo\Connection',
        // 设置查询类
        'query'         => '\think\mongo\Query',
        // 服务器地址
        'hostname'      => '127.0.0.1',
        // 集合名
        'database'      => 'comments',
        // 用户名
        'username'      => '',
        // 密码
        'password'      => '',
        // 端口
        'hostport'      => '',
        'pk_convert_id' => true,
    ];
控制器调用模型报错型错误: Argument 1 passed to think\db\Query::__construct() must be an instance of think\db\Connection, instance of think\mongo\Connection given, called in /Users/tegic/Documents/www/sghelp/thinkphp/library/think/Db.php on line 128
最佳答案
评论() 相关
后面还有条评论,点击查看>>