[尝试运行由protoc
从一堆*.proto
文件中生成的PHP客户端代码。 PHP代码在具有php7.3的docker容器上运行,并且安装并启用了GRPC扩展:pecl/grpc is already installed and is the same as the released version 1.23.1
。
当代码运行时,出现以下错误:Class 'Grpc\BaseStub' not found
。
错误由以下行触发:class ProductServiceClient extends \Grpc\BaseStub {
。这是自动生成的代码中的一行,因此无法修改。
[编辑]运行composer require grpc/grpc
解决了此问题;但是,我现在有Class 'Google\Protobuf\Internal\Message' not found
。
[编辑]运行composer require google/protobuf
解决了第二个问题。
尝试添加grpc库:
composer require grpc/grpc