Base64_encode for URLS
Is there a base64_encod开发者_JS百科e function that is URL safe in PHP?
It also needs to be decodable obviously.
urlencode(base64_encode($var));
No. There isn't one built-in.
You can simply do this,
$encoded = strtr(base64_encode($data), '+/=', '-_.');
$data = base64_decode(strtr($encoded, '-_.', '+/='));
精彩评论