Base64 Encode and Decode String in PHP

by Mohan 2012-09-18 09:29:57



<h2>Base64 Encode and Decode String in PHP</h2>

function base64url_encode($plainText) {
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
return $base64url;
}

function base64url_decode($plainText) {
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
return $base64;
}
659
like
0
dislike
0
mail
flag

You must LOGIN to add comments