开发者

Base64_encode for URLS

开发者 https://www.devze.com 2023-01-05 19:02 出处:网络
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));

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, '-_.', '+/='));
0

精彩评论

暂无评论...
验证码 换一张
取 消