V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hehewf
V2EX  ›  PHP

有没有使用过 drslump/Protobuf- PHP 的,求大神指教。

  •  
  •   hehewf · 2017-03-06 13:03:08 +08:00 · 2696 次点击
    这是一个创建于 2599 天前的主题,其中的信息可能已经有所发展或是发生改变。
    已生成 proto 对应的 php 文件,调用方法 serializeToString 没有反应,报错也没有。
    第 1 条附言  ·  2017-03-15 09:15:28 +08:00
    已经解决。使用 allegro/php-protobuf 的 serializeToString 方法。(需求是: php 与 C++的 socket 通讯——内容体使用 protobuf 存储。)自己整理一下文章,比较杂乱,用需要的可以看一眼,提提建议。 http://www.diyisite.com/index.php/Home/Article/index/id/88.html
    4 条回复    2017-03-15 09:11:02 +08:00
    crystom
        1
    crystom  
       2017-03-06 13:07:12 +08:00   ❤️ 1
    只有 serialize 方法
    hehewf
        2
    hehewf  
    OP
       2017-03-12 17:33:19 +08:00
    @crystom 已经解决了。 php 开启了 protobuf 的拓展以后,就有了 serializeToString 这个方法。 protobuf 一开始没有搞好。现在可以了。
    crystom
        3
    crystom  
       2017-03-15 04:06:07 +08:00   ❤️ 1
    @hehewf 你用 allegro/php-protobuf 的话确实是 serializeToString 方法,不过用 drslump/Protobuf- PHP 或者其 fork 版本的话,是 serialize 方法
    hehewf
        4
    hehewf  
    OP
       2017-03-15 09:11:02 +08:00
    @crystom 嗯嗯。已经解决。用的是 allegro/php-protobuf 的 serializeToString 方法。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5539 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 01:31 · PVG 09:31 · LAX 18:31 · JFK 21:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.