Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

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

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!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...