【发布时间】:2016-03-29 08:17:45
【问题描述】:
我为 php7 编译了库 couchbase:https://github.com/couchbase/php-couchbase/tree/php7。 当我尝试进行操作(更新插入)时出现错误。
$cluster = new CouchbaseCluster('127.0.0.1', "user", "password");
$db = $cluster->openBucket('default');
$db->upsert('testdoc', ['name' =>'Frank']);
PHP Warning: Invalid callback , no array or string given in Unknown on line 0
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. CouchbaseBucket->upsert() php shell code:1
PHP 3. _CouchbaseBucket->upsert() [CouchbaseNative]/CouchbaseBucket.class.php:134
PHP Warning: Invalid callback , no array or string given in Unknown on line 0
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. CouchbaseBucket->upsert() php shell code:1
PHP 3. _CouchbaseBucket->upsert() [CouchbaseNative]/CouchbaseBucket.class.php:134
如果我尝试
$db->upsert('testdoc', 'Frank');
或
$db->upsert('testdoc', json_encode(['key' => 'Frank']) );
生成相同的警告并在 couchbase 中为该键(testdoc)插入一个空字符串。如何解决此错误?
【问题讨论】:
-
哪个操作系统/架构以及哪个特定的 PHP 版本?