base64字符串图片显示

2020-06-10  本文已影响0人  超级笔记本
  1. 后端将字节数组经过base64编码,返回字符串
        byte[] bytes = xxx;
        ...
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(bytes);
  1. 前端通过拼接字符串,赋值给img得src
src = “data:image/png;base64," + res;
上一篇 下一篇

猜你喜欢

热点阅读