1 var name='测试文字'; 2 3 var t_name=encodeURIComponent(name); 4 t_name=window.btoa(t_name); 5 6 console.log(t_name,'base64==>') 7 8 9 var p_name=window.atob(t_name); 10 11 p_name=decodeURIComponent(p_name) 12 13 console.log(p_name,'还原===》')