【问题标题】:Invalid arguments for couchbase at laravel?laravel 的 couchbase 参数无效?
【发布时间】:2017-07-13 13:46:17
【问题描述】:

我对 laravel 5.4 有疑问

我正在使用mpociot/couchbase。 我建立了php couchbase和php/pcs的couchbase服务器和模块

但我有以下错误。

(1/2) ErrorException
Couchbase\Cluster::__construct() expects exactly 1 parameter, 3 given

config/database.php

  'couchbase' => [
        'driver'   => 'couchbase',
        'host'     => 'localhost',
        'port'     => '8091',
        'bucket'   => 'travel-sample',
        'username' => '',
        'n1ql_hosts' => [
            'http://'.env('DB_HOST', 'localhost').':8093'
        ]
    ],

我哪里错了? 谢谢

【问题讨论】:

    标签: php laravel couchbase


    【解决方案1】:
    1. 沙发底座扩展不再需要 pcs
    2. src/Mpociot/Couchbase/Connection.php#L270中的构造函数应该写成

      $cluster = new Cluster($config['host']);
      if (!empty($config['user']) && !empty($config['password'])) {
          $cluster->authenticateAs(strval($config['user']), strval($config['password']));
      }
      return $cluster;
      

      这是在 Laravel 5.5 的分支上的 ytake/Laravel-Couchbase 中完成的。

    【讨论】:

      【解决方案2】:

      这是 mpociot 的 repo 中的一个错误,不再受支持。

      repo 已移至https://github.com/ORT-Interactive-GmbH/laravel-couchbase,我们支持此 repo ;)

      【讨论】:

      • 我解决了这个问题,我使用了这个包。我的问题的原因,couchbase 版本太多了。我的第一个 couchbase 版本 2.3.3,但是这个包支持 2.2.0 版本。
      猜你喜欢
      • 1970-01-01
      • 2016-02-05
      • 1970-01-01
      • 2018-12-09
      • 1970-01-01
      • 1970-01-01
      • 2015-06-29
      • 2022-01-27
      • 2018-02-26
      相关资源
      最近更新 更多