字符串的加密和解密
文章目录
仅支持浏览器端:
// 字符串编码
function encode (str) {
return window.btoa(encodeURIComponent(str))
}
// 字符串解码
function decode(str) {
return decodeURIComponent(atob(str))
}
console.log(encode('yangyingjie'))
仅支持浏览器端:
// 字符串编码
function encode (str) {
return window.btoa(encodeURIComponent(str))
}
// 字符串解码
function decode(str) {
return decodeURIComponent(atob(str))
}
console.log(encode('yangyingjie'))
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论