PHP urlsafeB64Decode()

Jmnote (토론 | 기여)님의 2021년 7월 19일 (월) 11:24 판 (Jmnote님이 PHP urlsafe b64decode() 문서를 PHP urlsafeB64Decode() 문서로 이동했습니다)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP urlsafeB64Decode()
with padding
function base64url_decode($input) { 
    return base64_decode(strtr($input, '-_', '+/').str_repeat("=",-strlen($input) & 3));
} 
echo base64url_decode('SGVsbG8gV29ybGQ='); # Hello World
without padding ★
function urlsafeB64Decode($input)
{
    $remainder = strlen($input) % 4;
    if ($remainder) {
        $padlen = 4 - $remainder;
        $input .= str_repeat('=', $padlen);
    }
    return base64_decode(strtr($input, '-_', '+/'));
}
echo urlsafeB64Decode('SGVsbG8gV29ybGQ'); # Hello World
function urlsafeB64Decode($input)
{
    return base64_decode(strtr($input, '-_', '+/'));
}
echo urlsafeB64Decode('SGVsbG8gV29ybGQ'); # Hello World

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}