1 개요[ | ]
- 함수 urlsafe_b64encode()
2 PHP[ | ]

with padding
PHP
Copy
function urlsafe_b64encode($input)
{
return strtr(base64_encode($input), '+/', '-_');
}
echo urlsafe_b64encode('Hello World'); # SGVsbG8gV29ybGQ=
Loading
without padding
PHP
Copy
function urlsafeB64Encode($input)
{
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
echo urlsafeB64Encode('Hello World'); # SGVsbG8gV29ybGQ
Loading
3 Python[ | ]

Python
Copy
from base64 import urlsafe_b64encode
s = b'Hello World'
print( urlsafe_b64encode(s) ) # b'SGVsbG8gV29ybGQ='
Loading
4 같이 보기[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.