gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 11:13:25 27 4
gpt4 key购买 nike

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

最佳答案

要在您的 Go 程序中读取此类数据,您必须在 Go 中重新实现 unserialize PHP 函数。不过,我怀疑这是一项容易的任务。

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

关于php - 如何用 Golang 解码 PHP 序列化的 Redis 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33011305/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com