美文网首页
base64字符串图片显示

base64字符串图片显示

作者: 超级笔记本 | 来源:发表于2020-06-10 14:45 被阅读0次
  1. 后端将字节数组经过base64编码,返回字符串
        byte[] bytes = xxx;
        ...
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(bytes);
  1. 前端通过拼接字符串,赋值给img得src
src = “data:image/png;base64," + res;

相关文章

网友评论

      本文标题:base64字符串图片显示

      本文链接:https://www.haomeiwen.com/subject/nryszhtx.html