tp6使用阿里云tablestore报错

tp6.0.12安装composer

composer require aliyun/aliyun-tablestore-sdk-php

完整代码

<?php
namespace app\controller;

use app\BaseController;

//tablestore
use Aliyun\OTS\Consts\ColumnTypeConst;
use Aliyun\OTS\Consts\PrimaryKeyTypeConst;
use Aliyun\OTS\Consts\RowExistenceExpectationConst;
use Aliyun\OTS\OTSClient as OTSClient;

class Index extends BaseController
{


    public function index()
    {
        $otsClient = new OTSClient (array (
            'EndPoint' => 'https://ts-instance2.cn-hangzhou.ots.aliyuncs.com',
            'AccessKeyID' => '12MGOT8t',
            'AccessKeySecret' => '123PibLT6TrWSrueuFp',
            'InstanceName' => 'ts-instance2'
        ));



        $request = array (
            'table_name' => 'xuetang',
            'primary_key' => array ( // 主键
                array('xuetang_id', 123),
            ),
            'max_versions' => 1
        );
        $response = $otsClient->getRow ($request);
        dump($response);
        exit;

    }

报错如下:
image.png
think \ exception \ ErrorException
During inheritance of ArrayAccess: Uncaught think\exception\ErrorException: Return type of Google\Protobuf\Internal\RepeatedField::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\RepeatedField.php:233 Stack trace: #0 D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\RepeatedField.php(47): think\initializer\Error->appError(8192, 'Return type of ...', 'D:\phpEnv\www\t...', 233) #1 D:\phpEnv\www\tp1.com\vendor\composer\ClassLoader.php(571): include('D:\phpEnv\www\t...') #2 D:\phpEnv\www\tp1.com\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('D:\phpEnv\www\t...') #3 D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\Message.php(133): Composer\Autoload\ClassLoader->loadClass('Google\Protobuf...') #4 D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\Message.php(77): Google\Protobuf\Internal\Message->initWithGeneratedPool() #5 D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\FileDescriptorSet.php(37): Google\Protobuf\Internal\Message->__construct(NULL) #6 D:\phpEnv\www\tp1.com\vendor\google\protobuf\src\Google\Protobuf\Internal\DescriptorPool.php(60): Google\Protobuf\Internal\FileDescriptorSet->__construct() #7 D:\phpEnv\www\tp1.com\vendor\aliyun\aliyun-tablestore-sdk-php\src\OTS\ProtoBuffer\GPBMetadata\TableStore.php(374): Google\Protobuf\Internal\DescriptorPool->internalAddGeneratedFile('\n\xC1S\n\x11table_stor...') #8 D:\phpEnv\www\tp1.com\vendor\aliyun\aliyun-tablestore-sdk-

阅读 4.3k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进