Golang implementation for PHP's functions
go get -u github.com/leeqvip/gophp
package main
import (
"fmt"
"github.com/leeqvip/gophp"
)
func main() {
str := `a:1:{s:3:"php";s:24:"世界上最好的è¯è¨€";}`
// unserialize() in php
out, _ := gophp.Unserialize([]byte(str))
fmt.Println(out) //map[php:世界上最好的è¯è¨€]
// serialize() in php
jsonbyte, _ := gophp.Serialize(out)
fmt.Println(string(jsonbyte)) // a:1:{s:3:"php";s:24:"世界上最好的è¯è¨€";}
}
This project is licensed under the MIT license.