PHP7环境protobuf-3.3.0
参考文档https://segmentfault.com/a/1190000009389032一、安装包下载地址https://github.com/google/protobuf/releases下载protoc-3.3.0-linux-x86_64.zip、protobuf-php-3.3.0.zip二、解压unzip /usr/local/src/protoc-3.3.0
参考文档https://segmentfault.com/a/1190000009389032
一、安装包下载地址
https://github.com/google/protobuf/releases
下载protoc-3.3.0-linux-x86_64.zip、protobuf-php-3.3.0.zip
二、解压
unzip /usr/local/src/protoc-3.3.0-linux-x86_64.zip -d /usr/local/src/protoc-3.3.0-linux-x86_64/
unzip /usr/local/src/protobuf-php-3.3.0.zip -d /usr/local/src/
三、编辑proto文件
cd /usr/local/src/protobuf-3.3.0/
vim src/demo.proto
输入以下内容:
syntax = "proto3";
message SearchRequest {
string query = 1;
int32 page_number = 2;
int32 result_per_page = 3;
}
保存退出
四、生成GPBMetadata/Src/Demo.php、SearchRequest.php
/usr/local/src/protoc-3.3.0-linux-x86_64/bin/protoc --plugin=/usr/local/src/protobuf-3.3.0/php/generate_descriptor_protos.sh --php_out=src/ src/demo.proto
更多推荐
所有评论(0)