golang实现php里的serialize()和unserialize()序列和反序列方法
Golang 实现 PHP里的 serialize() 、 unserialize()
安装
go get -u github.com/techoner/gophp
用法
package main import ( "fmt" "github.com/techoner/gophp/serialize" ) func main() { str := `a:1:{s:3:"php";s:24:"世界上最好的语言";}` // unserialize() in php out, _ := serialize.UnMarshal([]byte(str)) fmt.Println(out) //map[php:世界上最好的语言] // serialize() in php jsonbyte, _ := serialize.Marshal(out) fmt.Println(string(jsonbyte)) // a:1:{s:3:"php";s:24:"世界上最好的语言";} }
github地址:https://github.com/techoner/g...
相关推荐
清风徐来水波不兴 2020-05-04
JasonYeung 2020-02-21
klarclm 2019-07-09
zhanggang 2018-09-20
86296238 2015-06-14
zhoubaiwen 2014-12-07
seaocean 2014-11-13
WHDCChinaBlog 2014-10-16
lhhui 2014-10-13
Victoryxu 2014-10-13
XuNeely 2019-07-01
mitesi 2019-06-29
88324358 2018-12-19
DreamLee 2018-07-04
匆匆那些年 2011-08-24
dz00 2019-06-27
小仙儿 2015-02-13
AngelicaA 2014-09-05