package聽util import聽( "encoding/base64" "errors" ) func聽Base64Encode(deText聽[]byte)聽[]byte聽{ return聽[]byte(base64.StdEncoding.EncodeToString(deText)) } func聽Base64Decode(enText聽[]byte)聽([]byte,聽error)聽{ deText,聽err聽:=聽base64.StdEncoding.DecodeString(string(enText)) if聽err聽!=聽nil聽{ return聽nil,聽errors.New("base聽decode聽error!") } return聽deText,聽nil }
有疑问加站长微信联系(非本文作者)