如何在php上使用base64_encode字节数组?

Jac*_*Sun 5 php base64

如何在php上使用base64_encode字节数组?

在java上

new BASE64Encoder().encode(byte[] bytes);
Run Code Online (Sandbox Code Playgroud)

Isr*_*iro -3

使用base64_encode($stringToEncode) 和base64_decode($stringToDecode)

例子:

$string = 'Test String';
$coded = base64_encode($string);
echo $coded;
// TyByYXRvIHJldSBhIHJvcGEgZG8gcmVpIGRlIFJvbWE=

$original = base64_decode($coded);
echo $original;
// Test String
Run Code Online (Sandbox Code Playgroud)