PHP urlsafe_b64encode()

Jmnote (토론 | 기여)님의 2021년 7월 19일 (월) 11:26 판 (→‎개요)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP urlsafe_b64encode()
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
function urlsafeB64Encode($input)
{
    return rtrim(strtr(base64_encode($input), '+/', '-_'),'=');
}
echo urlsafeB64Encode('Hello World'); # SGVsbG8gV29ybGQ

2 같이 보기[ | ]

3 참고[ | ]

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