base64 编码

base64为了解决邮件传输中,将图片转化为文本

Base64编码是从二进制到字符的过程,可用于在HTTP环境下传递较长的标识信息。

可用于在互联网传输图片、文件等。

参考自:base64_百度百科

Encodes the given string with base64.

This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.

Base64-encoded data takes about 33% more space than the original data.

参考自:

PHP: base64_encode - Manual

相关历史:

几年前,当引入邮件功能时,它完全基于文本,随着时间的推移,对图像和媒体(音频、视频等)等附件的需求出现了。 当这些附件通过互联网(基本上以二进制数据的形式)发送时,二进制数据在其原始形式中被破坏的可能性很高。 所以,为了解决这个问题,BASE64 出现了。

二进制数据的问题在于它包含空字符,在某些语言(如 C、C++)中表示字符串的结尾,因此以包含 NULL 字节的原始格式发送二进制数据将阻止文件被完全读取并导致数据损坏

Years ago, when mailing functionality was introduced, so that was utterly text based, as the time passed, need for attachments like image and media (audio,video etc) came into existence. When these attachments are sent over internet (which is basically in the form of binary data), the probability of binary data getting corrupt is high in its raw form. So, to tackle this problem BASE64 came along.

The problem with binary data is that it contains null characters which in some languages like C,C++ represent end of character string so sending binary data in raw form containing NULL bytes will stop a file from being fully read and lead in a corrupt data

参考自:

base64 - What is base 64 encoding used for? - Stack Overflow

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值