함수 urlsafe_b64encode()

1 개요[ | ]

함수 urlsafe_b64encode()

2 PHP[ | ]

with padding
function urlsafe_b64encode($input)
{
    return strtr(base64_encode($input), '+/', '-_');
}
echo urlsafe_b64encode('Hello World'); # SGVsbG8gV29ybGQ=
without padding
function urlsafeB64Encode($input)
{
    return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
echo urlsafeB64Encode('Hello World'); # SGVsbG8gV29ybGQ

3 Python[ | ]

from base64 import urlsafe_b64encode

s = b'Hello World'
print( urlsafe_b64encode(s) ) # b'SGVsbG8gV29ybGQ='

4 같이 보기[ | ]

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