Skip to content

Instantly share code, notes, and snippets.

@tsmsogn
Created July 31, 2015 01:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsmsogn/761bf57601c451b7d7f2 to your computer and use it in GitHub Desktop.
Save tsmsogn/761bf57601c451b7d7f2 to your computer and use it in GitHub Desktop.
[php]base64_url_encode() and base64_url_decode
<?php
// From: http://stackoverflow.com/questions/1374753/passing-base64-encoded-strings-in-url
function base64_url_encode($input) {
return strtr(base64_encode($input), '+/=', '-_,');
}
function base64_url_decode($input) {
return base64_decode(strtr($input, '-_,', '+/='));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment