Files
YeePay/lib/Security/Encodes.php
2024-04-01 09:54:43 +08:00

18 lines
361 B
PHP

<?php
namespace Yeepay\Yop\Sdk\Security;
class Encodes
{
public static function base64url_encode($data)
{
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
public static function base64url_decode($data)
{
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
}