Is Base64_encode() in PHP equal to java.util.Base64?

隐身守侯 提交于 2019-12-13 09:39:18

问题


I want to use php to pass and get a encoded string to other system which are using java.util.Base64 to encode and decode. Can I use base64_encode($str) to encode and pass the string to them for decode in php and can i use base62_decode($str) to decode what I get from java.util.Base64 in php? Or is there other way to encode and decode java.util.Base64 string in php?

Thanks!!


回答1:


Short Answer: Yes.

Base64 is a standard.

Long Answer:

The PHP documentation for base64_encode references RFC 2045 which is the MIME base64 encoding.

The Javadoc tells that Java supports different types of Base64, one of which is MIME. The Basic type should also work. The main difference is that the MIME type requires that no line is longer than 76 characters.




回答2:


Yes, base64 is a standard that should work the same on all platforms.




回答3:


Of course, a standard format across different platform and language.



来源:https://stackoverflow.com/questions/49728951/is-base64-encode-in-php-equal-to-java-util-base64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!