[英]Base64_encode for URLS
Is there a base64_encode function that is URL safe in PHP? PHP 中是否有 URL 安全的 base64_encode 函数?
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, '-_.', '+/='));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.