如何用Golang解码PHP序列化的Redis响应


How to decode PHP serialized Redis response with Golang

我有一个问题,我的Redis数据库,它是用PHP序列化协议编码的,但我不知道我如何使用Golang解码这些数据,是否有类似JSON Unmarshall/Marshall的东西?

要在Go程序中读取这些数据,您必须在Go中重新实现unserialize PHP函数。但我怀疑这不是一件容易的事。

一个更好的解决方案是使用可移植的格式在Redis中存储数据,例如JSON或Google Protobuf。

我发现了这个https://github.com/wulijun/go-php-serialize我不知道你是否已经使用它

在golang中重新实现php的serializeunserialize

https://github.com/Trim21/go-phpserialize