PHP compatible serialization from C/C++

前端 未结 3 1615
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 19:03

Anyone know of a library that allows data to be serialized in C++ such that it can be deserialized using the default PHP \'unserialize\' function?

相关标签:
3条回答
  • 2021-01-12 19:11

    Here is the same question for Java. It should be pretty easy to write your own with examples. PHP its self is written in c and you could modify the deserialize source to your needs.

    0 讨论(0)
  • 2021-01-12 19:16

    There are several implementations for other languages here

    http://objectmix.com/php/362009-specification-serialize.html#post1335166

    The C implementation used by PHP itself is also here:

    http://svn.php.net/repository/php/php-src/branches/PHP_5_2/ext/standard/var.c

    http://svn.php.net/repository/php/php-src/branches/PHP_5_2/ext/standard/var_unserializer.c

    However, unless you're absolutely certain that your choice serialization format is going to be a major bottleneck, consider using a more readily available serialization format, like JSON, XML, Protocol Buffers, or WDDX.

    0 讨论(0)
  • 2021-01-12 19:20

    Since you're probably only serializing data, and not PHP objects, you may find a standardized "common ground" serialization more effective. (JSON is likely the simplest)

    0 讨论(0)
提交回复
热议问题